- b2evolution CMS User Manual
- Installation / Upgrade
- Moving your b2evolution Site
- Restoring a database backup
Restoring a database backup
A database backup is typically an SQL file with a name like b2evo_db_dump.sql
or b2evo_db_dump.sql.gz
. The .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
mysql
tool. 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.
Command line
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:
b2evo_db_dump.sql.gz
You can restore by using a command line like this one:
mysql -u MYSQL_USERNAME -p -h MYSQL_SERVER_ADDRESS DATABASE_NAME < b2evo_db_dump.sql
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:
USE `b2evo_db`;
Make sure the name ‘b2evo_db’ actually matched the real name of the database you are trying to restore to.