Restoring and importing a database to your database server
Find out how to restore and import your database
Find out how to restore and import your database
Last updated 29th June 2022
Following an error on your database, you must be able to restore a backup or import a local database.
This guide explains how to restore and import your database onto your database server.
Please note that the CloudDB solutions do not give access to the database management system, but to the databases hosted on it.
- Please note that there is no "root" access.
- Generic SQL commands work normally, and software such as HeidiSQL, SQuirreL or Adminer is fully compatible.
Log in to your OVHcloud Control Panel and select Web Cloud
in the top navigation bar. Click Databases
, then choose the database name concerned. Next, switch to the Databases
tab.
In the Backups column, the number corresponds to the available backups for your database.
Click the ...
button to the right of the database, then click Show backups
.
The list of available backups will appear. Click on the ...
button to the right of the backup you want to restore, then Restore the backup
.
Restoration involves overwriting the contents of the database, potentially resulting in data loss. If you are not sure what you are doing, please back up beforehand.
Click on the ...
button to the right of the database, then click Import file
.
There are two ways of doing this:
Click on Import a new file, then Next
.
Specify a name for your imported file, click Browse
to select it, confirm with Submit
, and then click Next
.
The file must be in .sql, .txt, or .gz format.
If you wish, tick Empty the current database before importing, and Send an email when importing is complete to be informed of the completion of the operation using the primary email address of your OVHcloud account. Then click Confirm
.
If you had already imported a file before, you can choose the Use an existing file option.
Then choose the file from the dropdown menu and click Next
.
If you wish, tick Empty the current database before importing, and Send an email when importing is complete to be informed of the completion of the operation using the primary email address of your OVHcloud account. Then click Confirm
.
In some cases, the RAM available in your database server does not allow you to carry out the desired import outside the Control Panel. If this is the case, we recommend using the tool available in the OVHcloud Control Panel.
To import your database directly from phpMyAdmin, you will need to log in to the interface first. To do this, you can refer to the section in this guide.
Once you have logged in to phpMyAdmin, select your database by clicking on its name.
Then click on the Import
tab.
Select your backup file by clicking Browse
. (Please note that the file cannot exceed 100 MB).
We recommend splitting your database into several files if it exceeds 100 MB and importing these files from phpMyAdmin.
You can import files larger than 100 MB in the OVHcloud Control Panel by following the step Restoring and importing a database from the Control Panel.
Keep the default options and click Run
to start the import.
This action is only possible via SSH from an OVHcloud Web Hosting plan.
cat database_name.sql | mysql --host=server --user=username --port=port --password=password database_name
1. <?php
2. echo "Your database is being restored.......";
3. system("cat database_name.sql | mysql --host=server --user=username --port=port --password=password database_name");
4. echo "Completed. Your database is in place on this Web Hosting plan.";
5. ?>
In some cases, the RAM available in your database server may not be sufficient to perform the desired import. If this is the case, we recommend using the tool available in the OVHcloud Control Panel.
This action is only possible via SSH from an OVHcloud Web Hosting plan, in stable or higher versions.
psql --host=server --port=port --user=username --password=password database_name < database_name.sql
1. <?php
2. echo "Your database is being restored.......";
3. system("PGPASSWORD=password psql --host=server --port=port --user=username --password=password database_name < database_name.sql");
4. echo "Completed. Your database is in place on this Web Hosting plan.";
5. ?>
Join our community of users on https://community.ovh.com/en/.
Please feel free to give any suggestions in order to improve this documentation.
Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.
Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.
Thank you. Your feedback has been received.
Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.
Discuss with the OVHcloud community