![]() This will write a backup file with the weekday in the filename so you would have a rolling set of backups. Use valid values for $USER, $PASSWORD, and $DATABASE. The nice -n 19 lowers the priority of the process. Nice -n 19 mysqldump -u $USER -password=$PASSWORD $DATABASE -c | nice -n 19 gzip -9 > ~/backup/wiki-$DATABASE-$(date '+%Y%m%d').sql.gz Cron enables users to schedule jobs (commands or shell scripts) to run periodically at certain times or dates.Ī sample command that you may run from a crontab may look like this: Remember to backup the additional file system components used by the wiki that might be required during a restore, like images, logo, skins and extensions.Ĭron is the time-based job scheduler in Unix-like computer operating systems. See MySQL Bug 109685 and Ubuntu Bug 2003866 for details. The issue was fixed in MySQL versions 5.7.42 and 8.0.33. If you do not use -single-transaction, then you should consider using the -lock-tables and -add-locks options.ĭue to an unexpected change in MySQL versions 5.7.41 and 8.0.32 in February 2023, the -single-transaction option required the backup user to have RELOAD or FLUSH_TABLES privileges. Include MySQL-specific table options in CREATE TABLE statements Issue a BEGIN SQL statement before dumping data from serverĭump stored routines (procedures and functions) from dumped databasesĪdd DROP DATABASE statement before each CREATE DATABASE statement Mysqldump -h hostname -u userid -p -xml dbname | gzip > Īdditional options you should consider using with mysqldump for a backup includes the following.ĭo not write CREATE LOGFILE GROUP or CREATE TABLESPACE statements in output Mysqldump -h hostname -u userid -p -xml dbname > backup.xmlĪnd to compress the file with a pipe to gzip Mysqldump -no-tablespaces -h hostname -u userid -p dbname | gzip > Ī similar mysqldump command can be used to produce XML output instead, by including the -xml parameter. The solution is to add the -no-tablespaces option to the command: Some newer versions of MySQL might show an error about tablespaces and PROCESS privilege. Mysqldump -h hostname -u userid -p dbname | gzip > The output from mysqldump can instead be piped to gzip, for a smaller output file, as follows See mysqldump for a full list of command line parameters. Īfter running this line from the command line mysqldump will prompt for the server password (which may be found under Manual:$wgDBpassword in LSP). While dbname may be found under $wgDBname. If whatever is not specified mysqldump will likely use the default of utf8, or if using an older version of MySQL, latin1. Userid may be found under $wgDBuser, whatever may be found under $wgDBTableOptions, where it is listed after DEFAULT CHARSET=. Hostname may be found under $wgDBserver by default it is localhost. Substituting hostname, userid, whatever, and dbname as appropriate.Īll four may be found in your LocalSettings.php (LSP) file. Mysqldump -h hostname -u userid -p -default-character-set=whatever dbname > backup.sql This can be removed as soon as the dump is completed.Įxample of the command to run on the Linux/UNIX shell: ![]() $wgReadOnly = 'Dumping Database, Access will be restored shortly' When using the default MySQL or MariaDB backend, the database can be dumped into a script file which can be used later to recreate the database and all the data in it from scratch. If your wiki is currently offline, its database can be backed up by simply copying the database file. Most of the critical data in the wiki is stored in the database.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |