How to Import/Export MySQL database via SSH Print

  • 0

1.Exporting a MySQL database
To export a MySQL database, you need to use the mysqldump command. Use the below command to export the database
# mysqldump -u [username] -p [password] [database_name] > [dumpfile.sql]

You will be prompted for a password, type in the password for the username and press Enter. Replace the brackets and the information within them with your database information.

And you can export the single table from your database. Use the below command to export table
# mysqldump -u [username] -p [password] [database_name] [table_name] > [table_name.sql]

It will be prompted again you need to replace the brackets and the information within them with your database information.

2.Importing a MySQL database
To import a MySQL database, you need to use the mysql command. Use the below command to import the database and file must be in .sql format,It can not be in zipped format (.zip or .tar.zip)
# mysql -u [username] -p [password] [database_name] > [dumpfile.sql]

And you can also import single table into an existing database. Use the below command to import the single table.
# musql -u [username] -p [password] [database_name] > [table_name.sql]

You will be prompted for a password, you need to replace the brackets and the information within them with your database information and for database you must use an existing database.

Note: Prior to exporting and importing the database, SSH will need to be enabled for your domain. Once the database has been exported, you may download the database dump file via FTP.

I hope this article will helps you!!
Done!

Was this answer helpful?

« Back