In this article we will show you how to export and import a MySQL database via SSH. Managing your databases via SSH is especially useful when dealing with large databases (over 50Mb).
1. Exporting a MySQL database
To export a MySQL database, you need to use the mysqldump command. Here is the full command for exporting your database:
mysqldump -uUSERNAME -pPASSWORD DATABASE > backup.sql
Make sure you replace USERNAME, PASSWORD and DATABASE with the appropriate values for your database. The MySQL database will be exported to a file named "backup.sql" in your current directory. The name of the MySQL dump you are exporting to can be whatever you want.
2. Importing a MySQL database
To import a MySQl database, you need to use the mysql command. Here is the full command for importing a MySQL dump into a database:
mysql -uUSERNAME -pPASSWORD DATABASE < backup.sql
Make sure you replace USERNAME, PASSWORD and DATABASE with the appropriate values for your database. For DATABASE you must use an existing database.
- 0 Usuários acharam útil
Artigos Relacionados
What type of databases do you support? PGSQL and MySQL?
All our servers support MySQL and PostgreSQL databases. Also with any of our hosting packages...
How to repair a MySQL database?
In this article we will show you two ways to repair a MySQL database. 1) Through...
How to optimize a MySQL database using phpMyAdmin?
It is always a good idea to keep your databases' tables optimized. Fortunately, making this...
How to change the database engine of a MySQL database table?
In this article we will show you how to change the database engine of a MySQL table. Let's...
I get an error 'ACCESS DENIED CREATE DATABASE db_name' when I try to import a database
In order to solve this issue follow these steps: Open the MySQL dump with a text editor on...