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

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Lines and paragraphs break automatically.
  • Allowed HTML tags: <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>

More information about formatting options

Captcha
Enter the text exactly as it appears to continue
Copy the characters (respecting upper/lower case) from the image.