31,040
edits
mNo edit summary Tag: 2017 source edit |
|||
| (15 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
[[Category: | <!-- BEGIN origin interlang links --> | ||
{{ | <!-- You can edit this section but do NOT remove these comments | ||
Links below will be automatically replicated on translated pages by PolyglotBot --> | |||
[[fr:Restaurations]] | |||
[[es:Restauraciones]] | |||
[[zh:还原]] | |||
<!-- END interlang links --> | |||
[[Category:Admin_en]] | |||
{{TemplateDocUser}} | |||
This page describe how to restore a backup of Dolibarr (for example after formatting your hard disk). To know how to do a complete backup, see page [[Backups|Backup]]. | This page describe how to restore a backup of Dolibarr (for example after formatting your hard disk). To know how to do a complete backup, see page [[Backups|Backup]]. | ||
| Line 10: | Line 18: | ||
* You know a login of an admin user you used before, when old Dolibarr backup was done. | * You know a login of an admin user you used before, when old Dolibarr backup was done. | ||
= Reinstall Dolibarr software = | = Step 1 - Reinstall Dolibarr software = | ||
If you have uninstalled Dolibarr or not yet installed because you are on a new server, you must install Dolibarr as if you want to use it with a new clean database. | If you have uninstalled Dolibarr or not yet installed because you are on a new server, you must install Dolibarr as if you want to use it with a new clean database. | ||
Be carefull to choose the same database type than before (Mysql, PostgreSQL...). | Be carefull to choose the same database type than before (Mysql, PostgreSQL...). | ||
You can install any Dolibarr distribution of your choice (Dolibarr, DoliWamp, DoliMamp, any other Linux distribution...), however it must be exactly the same version (vX.Y) than the one used to make the backup | You can install any Dolibarr distribution of your choice (Dolibarr, DoliWamp, DoliMamp, any other Linux distribution...), however it must be exactly the same version (vX.Y) than the one used to make the backup. The version may be included in the file name of the database backup. | ||
= Restore documents = | = Step 2 - Restore documents = | ||
On your new installed Dolibarr, go with an administrator user in the menu '''Home / System Tools / Restore'''. | On your new installed Dolibarr, go with an administrator user in the menu '''Home / System Tools / Restore'''. | ||
| Line 23: | Line 31: | ||
All you have to do then is to copy content of your saved directory of old documents files into this directory. | All you have to do then is to copy content of your saved directory of old documents files into this directory. | ||
= Restore the database = | = Step 3 - Restore the database = | ||
== MySql == | == MySql == | ||
Copy the backup dump file into the same directory than the command '''mysql'''. | Copy the backup dump file into the same directory than the command '''mysql'''. | ||
| Line 36: | Line 44: | ||
Dolibarr offers a command line to launch to restore the database. Click on "Show the full command". | Dolibarr offers a command line to launch to restore the database. Click on "Show the full command". | ||
For example, you will have : | For example, you will have : | ||
< | <syntaxhighlight lang="bash"> | ||
mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql | mysql mydatabase -h localhost -u databaseuser -pdatabasepass < mybackupfile.sql | ||
</ | </syntaxhighlight> | ||
Open a command line shell (DOS Command line with Windows). | Open a command line shell (DOS Command line with Windows or a Shell terminal with Linux). | ||
Go into the directory where command '''mysql''' and your backup file is stored. | Go into the directory where command '''mysql''' and your backup file is stored. | ||
Launch the command provided previously. | Launch the command provided previously. | ||
| Line 49: | Line 57: | ||
=== Troubleshooting === | |||
[[File:Warning.png]] ERROR 1005 (HY000) at line 20: Can't create table `dolibarr`.`llx_accounting_account` (errno: 150 "Foreign key constraint is incorrectly formed") | [[File:Warning.png]] ERROR 1005 (HY000) at line 20: Can't create table `dolibarr`.`llx_accounting_account` (errno: 150 "Foreign key constraint is incorrectly formed") | ||
| Line 59: | Line 67: | ||
Eg: Add FOREIGN_KEY_CHECKS in headers and footers: | Eg: Add FOREIGN_KEY_CHECKS in headers and footers: | ||
< | <syntaxhighlight lang="sql"> | ||
-- SQL Dump | -- SQL Dump | ||
-- Server version: 5.5.8 | -- Server version: 5.5.8 | ||
| Line 83: | Line 91: | ||
SET FOREIGN_KEY_CHECKS=1; | SET FOREIGN_KEY_CHECKS=1; | ||
</ | </syntaxhighlight> | ||
==PostgreSql== | ==PostgreSql== | ||
| Line 90: | Line 98: | ||
{{ToComplete}} | {{ToComplete}} | ||
= Use your restored Dolibarr = | = Step 4 - Use your restored Dolibarr = | ||
After command is finished, you can go on Dolibarr logon. | After command is finished, you can go on Dolibarr logon. | ||
Now you must use a login account that was existing when the backup was done. | Now you must use a login account that was existing when the backup was done. | ||
=Related videos= | |||
Data restoration on a Docker installation: | |||
(vocal in french but subtitles are available and review in this language) | |||
<youtube width="200" height="120">6H9ItBB_jK8</youtube> | |||