MySQL Dump command line

 
cmd.exe, than cd DIRECTORYPATH (it's [C:\Program Files\MySQL\MySQL Server 5.7\bin] in my case)


then type a command among those below

0. Dump all 
Ex ) mysqldump --uID -pPASSWORD TABLENAME > FILENAME.sql 

1. Dump only one table

Ex ) mysqldump --uID -pPASSWORD DBNAME TABLENAME > FILENAME.sql 

2. Restore Dump 
Ex) mysql -ID -pPASSWORD DBNAME < FILENAME.sql

3. Dump with certain condition 
Ex) mysqldump -uID -pPASSWORD DBNAME TABLENAME -w'no=>7 and no<=10' >FILENAME.sql
Ex) mysqldump -uID -pPASSWORD DBNAME TABLENAME -w'Condition' > FILENAME.sql

>> Than it will dump only between 7 and 10 of column 'no' of the table.

4. Dump only Schema
mysqldump -uID -pPASSWORD -d DBNAME > FIILENAME.sql

5. Dump only schema of one table
mysqldump -uID -pPASSWORD -p -d DBNAME TABLENAME > FILENAME.sql 

Previous
Next Post »