How do I restore a MySQL database from an sql dump?
There are several ways of restoring a MySQL database from an sql dump.
1. By using a commandline
If your MySQL user has a password, then use this command:
mysql -h localhost -u [MySQL user, e.g. root] -p[database password] [name of the database] < [name of your sql dump, e.g. sqldump.sql]
Please note: there’s no space between -p and the password!
If there's no password:
mysql -h localhost -u [MySQL user, e.g. root] [name of the database] < [name of your sql dump, e.g. sqldump.sql]
2. By using phpMyAdmin
1. To restore a database, click the SQL tab
2. On the SQL page, uncheck the Show this query here again
3. Browse to your backup of the database
4. Click Go
3. By using cPanel
1. Login to your cPanel
2. Under the files section, click on Backups
3. Under Restore a MySQL Database, click on Choose File. Next, navigate in the file browser to your database backup you'd like to restore, click on it, then click on Open.
4. You should now see your database backup that you've selected, go ahead and click Upload.
5. Finally you'll see the full backup that got restored.
4. By using Sypex Dumper
Download Sypex Dumper for free.
If you have any questions concerning MySQL database restoring, feel free to contact our Support Team.