Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Create user backup
- From him will run scripts
- CREATE USER 'backup'@'localhost' IDENTIFIED BY 'user_password';
- GRANT SELECT, SHOW VIEW, RELOAD, REPLICATION CLIENT, EVENT, TRIGGER ON *.* TO 'backup'@'localhost';
- GRANT LOCK TABLES ON *.* TO 'backup'@'localhost';
- Create directory for backup
- mkdir /backup/mysql/
- Create bash script database.sh with content:
- -----
- #!/bin/bash
- USER="backup"
- PASS="user_password"
- NOW="$(date +"%Y%m%d")"
- /usr/bin/mysqldump -u $USER -p$PASS -A | /bin/gzip > /backup/mysql/all--$NOW.sql.gz
- -----
- Making a file executable
- chmod +x database.sh
- And run file database.sh
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement