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 [/bash] For Plesk server [bash] # mysql -u admin -p`cat /etc/psa/.psa.shadow` database < /tmp/database.sql [/bash] To import a single table into an existing database you would use the following command: [bash] #mysql -u username -p -D database_name < tableName.sql [/bash]

Leave a Comment