How to Export/Import a MySQL database Via SSH? – When dealing with large database over 128MB it is recomended to manage them via SSH. More information on how connect to ans use SSH is available in this SSH Tutorial.

How to Export/Import a MySQL database Via SSH?

In this article, we will cover exporting and importing a database via SSH. Make sure that you replace the following variables in the commands below :

USERNAME – the MySQL user assigned to your database.

DATABASE – the name of your MySQL database.

  • Exporting a MySQL database

To export a MySQL database, use the mysqldump command. Here is the full command for exporting your database:

Mysqldump-uUSERNAME-p DATABASE > backup.sql

You will be prompted for a password – this is your MySQL user’s password.

The MySQL database will be exported to dile named “backup.sql” in your current directory.

  • Importing a MySQL database

To import a MySQL database, use the mysql command. Here is the full command :

Mysql-uUSERNAME –p DATABASE < backup.sql

Again, you will be prompted for the password of your MySQL user.

The backup.sql is the name of the file that your are importing to your database. It must be in your current workin directory.

Get your website ready today! AW Bali Web Design more than ready to help. Contact now via whatsapp +6287887990222 or via contact form.