My ultimate goal is to create a cron
script to automatically dump a selected MySQL database (ngsRunStats_FK
) once a day. Please note that the MySQL user ngs_run_stats
has all privileges on MySQL.
I was expecting the answer from Franklin here would do the job, though when I run on the terminal
mysqldump --defaults-extra-file=/home/user/.my.cnf -S /nexus/cliniphenome/mysql.sock -u ngs_run_stats -p ngsRunStats_FK --lock-tables=false > test.sql
I am still required to prompt my password. If I enter the password correctly, the dump will work as expected. Though, as stated previously, this should be done automatically i.e. without prompting for the password.
I am assuming that if I am being asked to prompt my password when I call the command on the terminal my cron
(not shown here) script will not work. Or is this assumption wrong?
My /home/user/.my.cnf
looks like so:
[mysqldump]
user = ngs_run_stats
password = mypassword
and has permissions 600