Skip to content

Instantly share code, notes, and snippets.

@Padilo300
Created December 20, 2022 18:52
Show Gist options
  • Save Padilo300/deed8fed528f3c11fb0fc180d5da98db to your computer and use it in GitHub Desktop.
Save Padilo300/deed8fed528f3c11fb0fc180d5da98db to your computer and use it in GitHub Desktop.
mysql data base backup shell script
#!/bin/sh
find /root/data_base_bk/dumps -name '*.*' -mmin +600 -delete > /dev/null #remove files after 10 hour
d=$(date +%Y-%m-%d-%H:%M:%S) #make current date
mysqldump -u mysql_user_name -h 127.0.0.1 --password='mysqk_password' -P 3306 --no-autocommit --opt data_base_name > "/root/data_base_bk/dumps/data_base_name$d.sql"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment