Created
June 11, 2010 16:46
-
-
Save infynyxx/434737 to your computer and use it in GitHub Desktop.
automated mysql dump using Linux Cron tab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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/ |
I have configured mysqldump on my mysql database server but,
- it takes only 20 byte mysql data.
- it doesn't take the backup automatically.
Here is my config on "/home/user/mysqldump.sh" script file
20 09 * * * root mysqldump -u root -pPASSWORD --all-databases | gzip > /home/user/Documents/database_
data '+%m-%d-%Y'
.sql.gzthen I restart the crontab "/etc/init.d/cron restart"
So , please if anyone have the solution.
If you read the file, you will see that's the password is wrong!
Make it like that: -u yourusername -p'YOURPASSWORD'
the -p is attached to '
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have configured mysqldump on my mysql database server but,
Here is my config on "/home/user/mysqldump.sh" script file
20 09 * * * root mysqldump -u root -pPASSWORD --all-databases | gzip > /home/user/Documents/database_
data '+%m-%d-%Y'
.sql.gzthen I restart the crontab "/etc/init.d/cron restart"
So , please if anyone have the solution.