MySQL Database Export and Import

Here's a couple quick tips to help you export and import a MySQL database. This is great when you're looking to move servers or just make backups of the data. I know lots of people use phpMyAdmin to manage their MySQL servers (as do I). But sometimes you need to get at large amounts of data. Web based apps won't cut it. You'll need shell access (ssh).

Exporting the MySQL Database
mysqldump -u USERNAME -pPASSWORD DATABASE_NAME > EXPORT_FILE.sql
Note the there is no space between the -p and the actual password. You may also omit the password. MySQL will prompt you for it.

Importing the MySQL Database
mysql -u USERNAME -pPASSWORD DATABASE_NAME < IMPORT_FILE.sql
Again you can omit the password here.

No votes yet