31,029
edits
Gschratzer (talk | contribs) Tag: 2017 source edit |
mNo edit summary Tag: 2017 source edit |
||
| Line 83: | Line 83: | ||
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 : | ||
< | <syntaxHighlight lang="bash"> | ||
mysqldump -u user -pyourpass --result-file=mysqldump_databasename_version_date.sql databasename | mysqldump -u user -pyourpass --result-file=mysqldump_databasename_version_date.sql databasename | ||
</ | </syntaxHighlight> | ||
where : | where : | ||
* ''user'' is MySQL user that Dolibarr use to connect to database, | * ''user'' is MySQL user that Dolibarr use to connect to database, | ||
| Line 99: | Line 99: | ||
If you want to have your file compressed (compressé) : | If you want to have your file compressed (compressé) : | ||
< | <syntaxHighlight lang="bash"> | ||
mysqldump databasename -h host -u user -pyourpass -l --single-transaction -K --add-drop-table=TRUE --tables -c -e --hex-blob --default-character-set=utf8 | bzip2 > mysqldump_databasename_version_date.bz2 | mysqldump databasename -h host -u user -pyourpass -l --single-transaction -K --add-drop-table=TRUE --tables -c -e --hex-blob --default-character-set=utf8 | bzip2 > mysqldump_databasename_version_date.bz2 | ||
</ | </syntaxHighlight> | ||
Dump file will be generated with a bzip compressed format. | Dump file will be generated with a bzip compressed format. | ||
| Line 107: | Line 107: | ||
With Linux, to make a regular backup at 1:30 each day into file mysqldump_databasename_DD.sql.bz2, you can add this into your cron file: | With Linux, to make a regular backup at 1:30 each day into file mysqldump_databasename_DD.sql.bz2, you can add this into your cron file: | ||
< | <syntaxHighlight lang="bash"> | ||
30 1 * * * mysqldump databasename -h host -u user -pyourpass -l --single-transaction -K --add-drop-table=TRUE --tables -c -e --hex-blob --default-character-set=utf8 | bzip2 > mysqldump_databasename_`date +%d`.sql.bz2 | 30 1 * * * mysqldump databasename -h host -u user -pyourpass -l --single-transaction -K --add-drop-table=TRUE --tables -c -e --hex-blob --default-character-set=utf8 | bzip2 > mysqldump_databasename_`date +%d`.sql.bz2 | ||
</ | </syntaxHighlight> | ||
=== Using phpMyAdmin === | === Using phpMyAdmin === | ||
| Line 127: | Line 127: | ||
[[File:Warning.png]] in any case, '''your sql backup file should disable foreign keys prior to restoring''', else your backup won't be restorable because of foreign keys clashing! | [[File:Warning.png]] in any case, '''your sql backup file should disable foreign keys prior to restoring''', else your backup won't be restorable because of foreign keys clashing! | ||
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 151: | Line 151: | ||
SET FOREIGN_KEY_CHECKS=1; | SET FOREIGN_KEY_CHECKS=1; | ||
</ | </syntaxHighlight> | ||