Trying to use mysqldump and cron on one db with password
For the password problem, do this: create a file /home/jv74/.my.cnf
with these contents:
[client]
user=myuser
password=mypassword
Give it the proper permissions:
chmod 600 /home/jv74/.my.cnf
This should stop mysql
(and mysqldump
) from asking for your password. When run by cron
you need to explicitly point to the option file:
mysqldump --defaults-file=/home/jv74/.my.cnf
As for the redirection to the proper folder, specify the full path:
mysqldump --defaults-file=/home/jv74/.my.cnf db_jv74 > /path/to/folder/dv_jv74_bk.sql