simple mysqldump example

This post shows how to export a database from the command line. You can export for backup purposes or you can export and move the sql database file to a new database server.

Here is a simple example of using mysqldump on ubuntu linux:

mysqldump -u root -p MY_DATABASE_NAME > /home/myuser/db_backup.2014.08.07.sql

And here is how to import the MySQL dump file to a new database:

mysql -u root -p NEW_DATABASE_NAME < /home/myuser/db_backup.2014.08.07.sql

mysql