Export/Import Mysql Database

Export a database mysql


# mysqldump -u -p username database_name > dbname.sql

Plesk Server


# mysqldump  -u admin -p`cat /etc/psa/.psa.shadow` wordpress_database > domain_backup_7.16.14.sql

To export a single table from your database you would use the following command:


# mysqldump -p --user=username database_name tableName > tableName.sql

Import a database or table


# mysql -p -u username database_name < file.sql 

For Plesk server


# mysql -u admin -p`cat /etc/psa/.psa.shadow` database < /tmp/database.sql

To import a single table into an existing database you would use the following command:


#mysql -u username -p -D database_name < tableName.sql