Eventhough we offer automatic backups on our webhosting packages, it is never a bad idea to manually make a backup of your website periodically.
In this tutorial we explain how to make a backup of the database of your website. We also explain how to place a backup back onto your webhosting package.
Attention! There is a connection between the files on your website and your database. When you make a backup of your database, we recommend strongly to also make a backup of your website's files.
When you restore a backup of your database, it is possible that you also need to restore a backup of your website's files.
We explain how to make and restore a backup of your website files in this article.
Making a backup of your website's database
The database contains the data of your website and can be reached via MySQL. We will explain how to log in to MySQL first and then how to make a backup of your database.
Go to the tab 'Domain & Hosting' in your controlpanel and click on your domain in the left column (do not check the box). Click on the cogwheel nest to 'Your website' and then 'Database'.
You will find an overview of your databases here. On this page you will find a link you can use to log in to MySQL, and also how many databases are in use at the moment. Below that are shown: The database name, username, and howmuch space is assigned to the database.
You can make a backup of your database directly via this page in the control panel. To do so, click on the blue download button next to the username.
If you want more advanced options when making your backup, follow the steps below.
When you click on the username in the database overview ('transiptutorials_com_example' in the example above), you will reach the MySQL login screen. You will notice that the host and username are already filled in for you. You only need to enter the password.
If you do not remember the password of your database, go back to the database overview in your control panel. Click on the Database Name to change your password and log in by using the new password.
Attention! Your website also needs access to your database. If you change your password this way, make sure your website also knows the password.
To change this, look up your config.php (or wp-config.php for WordPress websites) in your SFTP Filemanagement. You can usually find this file for your rootdomain in your 'www' folder.
Open the config file using a text editor such as 'Notepad++' or the PHP editor 'PhpStorm'. Look for the following line:
** MySQL database password */ define('DB_PASSWORD', 'password_old');
Replace password_old with your new database password. Save the file and upload it back to the 'www' folder.
When you are logged in to MySQL, you will see the screen as shown below. In this example we have installed WordPress, therefore the database that was made automatically by WordPress is shown.
If you have uploaded a website and database yourself, you will see that data instead. The steps for making a backup are equal in both situations.
Make sure the database is selected by clicking it in the left column. Our database is called "site_voorbeeld_nl_wordpre". Click the 'Export' button, which is marked red in the image.
You can now choose your Export method.
Pick the 'Quick' method and the 'SQL' format and click 'Go'. The backup will now be downloaded. Remember where you saved it, you may need it later.
Restoring a backup of your website's database
To restore an earlier version of your database, (for instance when you made a mistake which broke your database) follow the steps below.
Log in to MySQL and select your database in the database overview. To be able to restore a backup it is important that your current database is empty.
To empty your current database, click on 'Check all' in the database overview.
Select 'Drop' in the drop-down menu which says 'With selected'.
You will now be asked to confirm the action you took in the previous step. Click 'Yes'.
The database will now be empty and ready to receive the backup. Click the 'Import' tab and the button next to 'Browse your computer' on the next screen.
Look up the backup you made earlier. If you have used the download button in your control panel, you will have received the backup via e-mail.
Once you have selected your database, click 'Go'.
You will now see a confirmation that your database was imported succesfully.
If you have any questions regarding this article, please contact our support team. You can reach them using the 'Contact us' button below or via the 'Contact' button inside your control panel.
If you wish to discuss this article with other users, feel free to leave a comment below.