How can I backup and restore my MySQL databases?

There are two main ways to back up or restore a MySQL database on our servers: via SSH or the phpMyAdmin interface.

If you need SSH Telnet access, just send us a ticket with your request to be enabled for it. To access the phpMyAdmin interface, click on the "phpMyAdmin" on your control panel.


How create a backup a MySQL database using SSH:

Log into your account on our server and issue the following command:

/usr/bin/mysqldump DATABASENAME -u USER -pPASSWORD > /home/user/file.sql

Enter your actual username and password where we have indicated user and password. This will create a file called "file.sql" that contains your entire database.


How to restore a database using SSH :

Log into your account on our server and issue the following command:

mysql DATABASENAME -u USER -pPASSWORD < /home/user/file.dump


How to create a backup MySQL database using phpMyAdmin:

Click on your database name shown on the upper left.

Go to the section called "View dump (schema) of database" and choose options for backing up structure only, structure and data, or adding drop tables. To view what your backup file will look like, click on the "Go" button. When you're ready to send your back up to a file, check the send box and click "Go", then follow the prompts for how to name the file and where to send it.


How to restore a MySQL database using phpMyAdmin:

Click on your database name shown on the upper left.

Locate your back up file for the database that you want to restore. Open it and copy the entire contents.

Paste into the field called "Run SQL query/queries on database yourdomain_com" and click the "Go" button.

Was this answer helpful?

 Print this Article

Also Read

phpMyAdmin

phpMyAdmin is a third-party tool included with cPanel, used for maniuplating MySQL databases...

Why do I get error message: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' on shell?

If you get this error message when trying to use mysql command line utility from shell: Can't...

How do I connect to and use MySQL?

Please login to your control panel and follow these steps to create the database, user and its...

Can I connect remotely to MySQL database?

Yes! it is possible. For this you have to allow remote access from your control panel, by adding...

MySQL Database Wizard

cPanel can guide you through the process of setting up a MySQL database, along with the...