Skip to content

Instantly share code, notes, and snippets.

@brunocarvalhodearaujo
Forked from infynyxx/mysql_dump.sh
Created December 22, 2017 16:56
Show Gist options
  • Save brunocarvalhodearaujo/d360014006ffc25bb32ac2884cca4b7d to your computer and use it in GitHub Desktop.
Save brunocarvalhodearaujo/d360014006ffc25bb32ac2884cca4b7d to your computer and use it in GitHub Desktop.
automated mysql dump using Linux Cron tab
#!/bin/sh
mysqldump -u root -pmysql123 –all-databases –routines| gzip > /root/MySQLDB_`date ‘+%m-%d-%Y’`.sql.gz
mysqldump -h 172.16.21.3 -u root -pmysql123 –all-databases –routines | gzip > /root/MySQLDB.3_`date ‘+%m-%d-%Y’`.sql.gz
#now create cron script smth like this
#crontab -e
#30 15 * * * /root/MySQLdump.sh 2>&1>> /root/MySQLdump.log
#The above will dump the database every day at 15:30.
#http://dbperf.wordpress.com/2010/06/11/automate-mysql-dumps-using-linux-cron-job/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment