In some cases you will prefer or will need to use the command line in order to export or import a MySQL database. The most common reason is when the database is really big.
In this guide we explain how to export and import a MySQL database using the command line.
Exporting a MySQL database
In order to export a MySQL database you must have access to a Unix, Linux or OS X system with MySQL client utilities.
Sppose that you have a database called myweb_db and a MySQL username called myweb_user with privileges on the database, you will have to run the following command:
mysqldump -u myweb_user -p myweb_db > myweb_db.sql
Importing a MySQL database
Once you have entered your hosting account using SSH, execute the following command:
mysql -u myweb_user -p myweb_db < myweb_db.sql
NOTE: You wull have to replace myweb_user and myweb_db with the correct values.