How to export / import database in linux via cmdline?

Export full database

 

To export database, use the following command. (where username is database user)

Enter the password when prompted

mysqldump -uUSERNAME -p USER_DATABASE > FILENAME.sql

 

Then import using:

mysql -uUSERNAME -p USER_DATABASE < FILENAME.sql

 

Export /dump particular table from a database 

 

For exporting particular tables from a database, following command is used :

mysqldump -uUSERNAME -p USER_DATABASE table1 table2 ... tabllen > FILENAME.sql

 

Was this answer helpful? 0 Users Found This Useful (0 Votes)