Wiki page mariadb changed with summary [[Backup database] added crontab and changed the script info] by Daniel
This commit is contained in:
parent
f9ded87ec1
commit
fb26597ec2
1 changed files with 8 additions and 2 deletions
|
@ -100,8 +100,13 @@ EXIT;
|
||||||
|
|
||||||
===== Backup database =====
|
===== Backup database =====
|
||||||
|
|
||||||
You can dump all databases just with this command ''mysqldump --single-transaction --flush-logs --master-data=2 --all-databases -u root -p | gzip > all_databases.sql.gz
|
You can dump all databases with the following command ''mysqldump --single-transaction --flush-logs --master-data=2 --all-databases -u root -p | gzip > all_databases.sql.gz
|
||||||
'' or use the script below.
|
''.
|
||||||
|
|
||||||
|
Or use the following script, which contains:
|
||||||
|
* separate databases (when you extract the file)
|
||||||
|
* define after how many days the old backups should be deleted
|
||||||
|
* email notification
|
||||||
|
|
||||||
<code>
|
<code>
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
@ -169,6 +174,7 @@ rm -rf $NOW
|
||||||
find $DEST -mtime +$DAYS -exec rm -f {} \;
|
find $DEST -mtime +$DAYS -exec rm -f {} \;
|
||||||
</code>
|
</code>
|
||||||
|
|
||||||
|
Use [[en/server/services/crontab#examples|crontab]] for automation.
|
||||||
===== Restore database =====
|
===== Restore database =====
|
||||||
|
|
||||||
<code>
|
<code>
|
||||||
|
|
Loading…
Reference in a new issue