Skip to content

Latest commit

 

History

History
121 lines (78 loc) · 5.82 KB

File metadata and controls

121 lines (78 loc) · 5.82 KB
title excerpt updated
Backing up and exporting a database of your database server
Find out how to back up and export your database
2023-10-26

Objective

Your database can contain a lot of essential information for your website. It is therefore important to be able to save it, or even export it.

Find out how to back up and export your database from your database server.

Requirements

Instructions

Please note that the Web Cloud Databases{.external} 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.

Backing up and exporting a database from the Control Panel

Log in to your OVHcloud Control Panel and select Web Cloud{.action} in the top navigation bar. Click Web Cloud Databases{.action} in the services bar, then choose the SQL instance concerned. Next, go to the Databases tab.

In the Backups column, the number corresponds to the number of backups available for your database.

[!primary]

  • Backups are performed automatically once a day for all your databases.
  • Automatic and manual backups are available for 30 days. After this period, they will be automatically deleted.

1. Launching a manual backup

Click the ...{.action} button to the right of the database, then click Back up now{.action}.

Web Cloud Databases{.thumbnail}

2. Exporting a backup

Click the ...{.action} button to the right of the database, then click Show backups{.action}

Web Cloud Databases{.thumbnail}

The list of available backups will appear. Click on the ...{.action} button to the right of the backup you want to create, then click Download the backup{.action} to retrieve this backup.

Backing up and exporting a database outside the Control Panel

1. Exporting MySQL or MariaDB databases

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 will enable you to use resources external to your solution.

1.1 Exporting a MySQL or MariaDB database with OVHcloud phpMyAdmin

To export your database directly from phpMyAdmin, you will need to log in to the interface first. To do this, you can refer to our guide on connecting to a database.

Once you have logged in to phpMyAdmin, click on the name of the database you want to export, then on the Export{.action} tab at the top.

You have two possible export modes. If you do not have a specific need, we recommend using quick mode in SQL format.

Web Cloud Databases{.thumbnail}

1.2 Exporting a MySQL or MariaDB database from the command line
mysqldump --host=server --user=username --port=port --password=password database_name > database_name.sql
1.3 Exporting a MySQL or MariaDB database with a PHP script
1. <?php echo "Your database is being backed up.......";
2. system("mysqldump --host=server --user=username --port=port --password=password database_name > database_name.sql");
3. echo "Completed. You can retrieve the database via FTP.";
4. ?>

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.

2. Exporting and importing PostgreSQL databases outside the Control Panel

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 will enable you to use resources external to your solution.

2.1 Exporting my PostgreSQL database from the command line
pg_dump --host=server --port=port --user=usernmame --password=password database_name > database_name.sql
2.2 Exporting a PostgreSQL database with a PHP script
1. <?php echo "Your database is being backed up.......";
2. system("PGPASSWORD=password pg_dump --host=server --port=port --user=username --password=password database_name > database_name.sql");
3. echo "Completed. You can retrieve the database via FTP.";
4. ?>

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.

Go further

Restoring and importing a database to your database server

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.