Problem with command line mysqldump database backups
I am having some trouble getting a command line mysqldump to work. Once a day I want to do a mysqldump of my database to a backup. Below is the command line, and I can't get it to work with or without passwords. Does anyone know why?
SHELL="/bin/bash"
35 1 * * 0 mysqldump -q my_forum_mysql_database -usite_user -pPASSwordhere > /backup/my_forum_backup_sunday.sql >/dev/null 2>&1
It is creating a file named my_forum_backup_sunday.sql with zero size.
-
Hi Please try this /usr/local/mysql/bin/mysqldump -uroot -ppassword --opt database > /path/to/directory/filename.sq Note: There is no space between the -p and password or -u and username - replace root with a correct database username. Regards HostNoc 0 -
It did not work. I've tried many combinations but I'm unable to do a mysql dump from a cronjob. 0 -
It did not work. I've tried many combinations but I'm unable to do a mysql dump from a cronjob.
To confirm, is it only not working via cronjob, or does it fail if you run the command manually as well?0 -
Hi Please also confirm did you made any script for Mysqldump? If yes then let us know the script name. Regards HostNoc 0 -
Check cron logs (should be in /var/log/cron) . Regards HostNoc 0 -
mysqldump works fine with command line, and when I run it from command I don't need to include a password or user, I simply use this when logged in as root, and it works fine: mysqldump -q my_database_name > /backup/my_file_name.sql This, however, will not work as a cronjob. The closest I may have come to this working as a cronjob is below: mysqldump -q my_database_name -umyusername -pmyuserpassword > /backup/my_file_name.sql and I get this error when I run that from a cronjob: /usr/local/cpanel/bin/jailshell: /backup/my_file_name.sql: No such file or directory 0 -
I got this to work from root command line, AFTER I first created the file name: mysqldump -q my_database_name > /backup/ my_file_name.sql 0 -
I'm happy to hear you reached a solution! 0
Please sign in to leave a comment.
Comments
8 comments