Exporting and importing MySQL databases from the command line Print

  • 1

To follow these instructions you will need SSH access to your hosting account. Contact us to have this set up.

Export Database

Use this command:

mysqldump -udbusername -p databasename -r databasename.sql
Import Database

First, connect to MySQL:

mysql -udatabaseusername -p --default-character-set=utf8 databasename

Then, at the MySQL prompt, import the database:

SOURCE databasename.sql

Was this answer helpful?

« Back