Restoring a database backup
A database backup is typically an SQL file with a name like
.gz at the end means the file is compressed with gzip.
If you want to restore such a backup on your existing (in case of a disaster) or a new (in case you’re moving your site) server, there are several ways:
- If you are not a technical person, ask your web host to do it for you. This is the easiest way.
- Use the cPanel / phpMyAdmin web interface to restore the database.
- Use the command line
mysqltool. This is the most robust way but requires shell access and is for tech savvy people only.
Before restoring the database, you will need to have an existing (even if it’s empty) database to restore to. The restore process will fill up that database. So before you try to restore, make sure you have created a new database on your server. You can do so using the cPanel / phpMyAdmin web interface provided with your hosting account.
If you have shell access, and once the file is uploaded on your server.
If it is a
.gz file, you can uncompress it like this:
You can restore by using a command line like this one:
Potential MySQL errors
#1046 - No database selected
This means that:
- either you have not created a database yet and the restore process is trying to restore to a non existing database ;
- you have misspelled the name of the database ;
- you have not specified a target database to restore to at all .
You may want to open your
.sql file and check if it has a line like this near the beginning:
Make sure the name ‘b2evo_db’ actually matched the real name of the database you are trying to restore to.
Created by • Last edit by on Sep 29, 2016
No feedback yet
Form is loading...