31,029
edits
PolyglotBot (talk | contribs) m (Import interlang links (links to translated versions of this page in other languages) from Multi Language Manager table.) |
mNo edit summary Tag: 2017 source edit |
||
| Line 69: | Line 69: | ||
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 85: | Line 85: | ||
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 93: | Line 93: | ||
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 113: | Line 113: | ||
[[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 137: | Line 137: | ||
SET FOREIGN_KEY_CHECKS=1; | SET FOREIGN_KEY_CHECKS=1; | ||
</ | </syntaxHighlight> | ||