Skip to content

Instantly share code, notes, and snippets.

@vekexasia vekexasia/.my.cnf Secret
Created Apr 22, 2012

Embed
What would you like to do?
Backup :)
[client]
host = localhost
user = backupuser
password = your-password-here
socket = /var/run/mysqld/mysqld.sock
#!/bin/bash
mkdir -p ~/mysqlbackups/
for i in $(mysql -Bse "show databases"); do
mysqldump $i > ~/mysqlbackups/$i.sql
done
CREATE USER 'backupuser'@'localhost' IDENTIFIED BY 'your-password-here';
GRANT SELECT ,
LOCK TABLES ,
SHOW VIEW ON * . * TO 'backupuser'@'localhost' IDENTIFIED BY 'your-password-here' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ;
config_version 1.2
snapshot_root /your/backup/folder/
cmd_rsync /usr/bin/rsync
cmd_ssh /usr/bin/ssh
cmd_cp /bin/cp
cmd_rm /bin/rm
cmd_logger /usr/bin/logger
cmd_du /usr/bin/du
retain daily 7
retain weekly 7
retain monthly 3
#client1 backups
backup backupper@client1:/home/backupper/mysqlbackups client1/
backup backupper@client1:/etc client1/ +rsync_long_args=--rsync-path='sudo rsync'
backup backupper@client1:/var/www client1/ +rsync_long_args=--exclude '/stats/*' --exclude '/log/*' --exclude '/phptmp/*' --exclude '/cache/*' --rsync-path='sudo rsync'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.