-
-
Save infynyxx/434737 to your computer and use it in GitHub Desktop.
#!/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.gz
then I restart the crontab "/etc/init.d/cron restart"
So , please if anyone have the solution.
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 '
Should read :
date +'%m-%d-%Y'`.sql.gz
singles quotes around date format and the + signe outside of quotes