Search


print PDF

How to back up a data base?


Warning: These backups only work on MyISAM. tables. The InnoDB tables are indeed not compatible with the snapshot system we use.

It is sometimes necessary to carry out back ups of your data base. You need your sql access codes:
- The login: the name of the database,
- The password,
- The sql host.

Warning! the name of the base takes the -n suffix for the base of the previous night and -s for the one of the beginning of the week.

You have 5 ways to carry out your dump:

1. Via the Manager

We recommend this solution when the dump has a very important size, to command a dump sending you need to:

- Log into your ManagerV3,
- Click on your domain name,
- On the left menu, click on 'Website hosting',
- Next, on the right page, click on 'Manage Sql',



- Then, click on 'Backup copy' in 'Online management',



- Select the base to export and the date of the backup, then click on 'Accept'.



You may recover your dump on 3 specific dates:

- the daily one: in that case, select 'present copy',
- the one of the previous day,
- the one of the beginning of the week carried out on Sunday night.

Once validated, it will take about ten minutes for your dump to be imported, then you will receive by email a link and the login to allow you to download the backup file (dump).

2. Via PhpMyadmin

To save your sql data, you may also use phpmyadmin, this solution is interesting as it is reachable from anyone. However, if your base is too big, you will have to export it table by table.

2 solutions are possible:

- You may install phpmyadmin, by following this manual InstallPhpMyAdmin, you will get the latest version,
- Via your interface, available at this address: yourhosting.ovh.net/phpMyadmin.

How to carry out this dump?

- Log into your phpmyadmin and select the correct sql host in the menu,



- Then click on your base name on the left menu,
- Click on Export on top of the page.



- Next, select your tables, click on 'Go'.



You will be able then to download your dump.

3. Via php script

This solution is interesting as it allows you to import many dumps and it is reachable from any hostings;

You have then to edit a php script:

In the scripts shown below:
- replace data_base_name by your file name
- replace sql_server by the server name on which the base is setup
- replace data_base_name by the name of your data base
- pass_word by the password corresponding to your base.


In php (backupbase.php):

<?
echo "your backup base is in progress.......

";
system("mysqldump --host=server_sql --user=base_name --password=pass_word
base_name>base_name.sql");
echo ""it's finished. You can recover the base via FTP";
?>

In perl (backupbase.cgi) :

#!/usr/bin/perl

print "Your base backup is in progress.......

";
system("mysqldump --host=server_sql --user=base_name --password=pass_word
base_name>base_name.sql");
print "it's finished. You can recover the base via FTP";

This command will generate a base_name.sql file in the directory where the script is placed.

In this file, you will find all SQL instructions to recreate the base as it was at the time of the backup of all data.

To execute it, launch a browser with this url:
http://yourdomain.com/script_path/bacupbase.php/cgi

Comment nr1: If your base is too big, you dump it table by table by adding "--tables table_name" at the end to get this command: mysqldump --host=server_sql --user=base_name --password=pass_word base_name --tables base_name>base_name.sql

Comment nr2: You may also zip this file to download it on your PC (via FTP or via the web).
To zip the file, execute gzip command, it will create the file by .sql.gz extension:
system ("gzip base_name.sql");


Example :

In PHP :

<?
echo "your backup base is in progress.......

";
system("mysqldump --host=sql3 --user=testbackup --password=RtPgDsmL testbackup > testbackup.sql");
echo "file zip.....

";
system("gzip testbackup.sql");
echo "it's finished. You can recover the base via FTP";
?>

In perl :

#!/usr/bin/perl

print "Your base backup is in progress.......

";
system("mysqldump --host=sql3 --user=testbackup --password=RtPgDsmL testbackup > testbackup.sql");
print "file zip.....

";
system("gzip testbackup.sql");
print "it's finished. You can recover the base via FTP";

Then you execute it with this url: ""http://testbackup.com/backupbase/backupbase.php/cgi""


4. Via SSH

For Plan offers (90, 240, 720, media and xxl), you can carry out the backup directly by SSH;

You get connected in ssh on your ftp, then you go to the directory to store the backup and you launch this command:

mysqldump --host=server_sql --user=base_name --password=pass_word
base_name>base_name.sql

Example:

mysqldump --host=sql3 --user=testbackup --password=RtPgDsmL testbackup > testbackup.sql


5. Intervention

If you want us to take care of this procedure, the price is proportional to the size of your base and starts from £3.50. For further information, consult the following manual Interventions.