Line 44:
Line 44:
== The database ==
== The database ==
+
There are 4 ways to backup your database:
+
+
= Dolibarr's system tools backup =
+
If you use a recent version of Dolibarr, connect with Dolibarr administrator account.
If you use a recent version of Dolibarr, connect with Dolibarr administrator account.
Then go to '''Home -> System tools -> Backups'''.
Then go to '''Home -> System tools -> Backups'''.
Choose options for your backup (if possible, keep all default values).
Choose options for your backup (if possible, keep all default values).
+
''Alternative'': the default method '''MySQL Dump (mysqldump)''' also needs that you have access to the mysqldump binary in execution on your server. If you are on a shared host that disable this access, you can try another method by setting MAIN_FEATURES_LEVEL=1, and then a new method '''MySQL Dump (php)''' will appear. This method is still experimental, so please try it first by yourself by making a backup and then restoring it on a local, non production server to check that your data is correctly saved.
+
+
= mysqldump =
If you prefer a manual mode, you can also use the backup tool designed for your database.
If you prefer a manual mode, you can also use the backup tool designed for your database.
With Mysql, the command to backup your database into a file is :
With Mysql, the command to backup your database into a file is :
Line 64:
Line 71:
With value used as example, we will get a dump file called ''dolibarr.3.2.20110518.sql.
With value used as example, we will get a dump file called ''dolibarr.3.2.20110518.sql.
−
[[File:Warning.png]] Do not trust '''PhpMyAdmin''' (or any other thirdparty tools) to generate your backup dump. PhpMyAdmin is a good tool, but, to generate a backup file, does not include all MySql options/changes. Only using the '''mysqldump''' command can guarantee you generate a dump file you can restore on any Mysql database server/version.
+
= phpMyAdmin =
+
+
You can also use phpMyAdmin to save your database, but you must enable one specific option for you to be able to restore your backup later on.
+
+
In phpMyAdmin, click on the tab '''Export''', then select your Dolibarr's database/tables (depending whether you are in multi-database view or tables view), and then '''enable''' the option '''Disable foreign key checks''', also check that the output will be SQL, and then you can validate your export.
+
+
= Third-Party Tools =
+
+
You can also use third-party database backup softwares, like php scripts that you can upload on your server (such as db2SQL by Howard Yeend or BigDump), or also use database designer/workbench softwares which generally offer to remotely connect to your database and allow you to make a full backup (along to remotely manage your database).
+
+
----
+
+
Note: in any case, '''your sql backup file should disable foreign keys prior to restoring''', else your backup won't be restorable!
+
Eg: Add FOREIGN_KEY_CHECKS in headers and footers:
+
SET FOREIGN_KEY_CHECKS=0;
+
Create table ...
+
+
Insert into ...
+
...
+
SET FOREIGN_KEY_CHECKS=1;
+
+
+
[[File:Warning.png]] Mysqldump is the most secure way to backup your data because it is developped along MySQL and thus is always up-to-date. '''PhpMyAdmin''' and other thirdparty tools may generate a correct SQL dump but may be outdated or miss some features (depending on options you choose).
== The documents ==
== The documents ==