title | excerpt | updated |
---|---|---|
Restoring and importing a database to your database server |
Find out how to restore and import your database |
2023-10-26 |
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.
- A Web Cloud Databases instance (included in a Performance web hosting plan) in your OVHcloud account
- Access to the OVHcloud Control Panel
[!primary]
Please note that the Web Cloud Databases 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
{.action} in the top navigation bar. Click Web Cloud Databases
{.action}, 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 ...
{.action} button to the right of the database, then click Show backups
{.action}.
The list of available backups will appear. Click on the ...
{.action} button to the right of the backup you want to restore, then Restore the backup
{.action}.
Warning
Restoration involves overwriting the contents of the database, potentially resulting in data loss. If you are unsure, please create a backup beforehand.
Click on the ...
{.action} button to the right of the database, then click Import file
{.action}.
There are two ways of doing this:
Click on Import a new file, then Next
{.action}.
Specify a name for your imported file, click Browse
{.action} to select it, confirm with Submit
{.action}, and then click Next
{.action}.
Warning
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
{.action}.
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
{.action}.
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
{.action}.
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.
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
{.action} tab.
Select your backup file by clicking Browse
{.action}. (Please note that the file cannot exceed 100 MB).
[!primary]
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
{.action} 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. ?>
Warning
- To prevent someone from accessing this file containing sensitive data, you can secure access to it.
- This action is only possible on an OVHcloud Web Hosting plan.
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.
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. ?>
Warning
- To prevent someone from accessing this file containing sensitive data, you can secure access to it.
- This action is only possible on an OVHcloud Web Hosting plan.
For specialised services (SEO, development, etc.), contact OVHcloud partners.
If you would like assistance using and configuring your OVHcloud solutions, please refer to our support offers.
Join our community of users.