Cron task, mysqldump, add a password

  • Thread starter Thread starter Deleted member 184953
  • Start date Start date
D

Deleted member 184953

Guest
Hello, this is the anacrontab i use to save my db:
Code:
1@daily 0 mysql_backup mkdir -p /srv/data/home/mysql_backup ; mysqldump -u root --all-databases | /bin/gzip -9 > /srv/data/home/mysql_backup/`date '+%F'`.databases.sql.gz ; find /srv/data/home/mysql_backup -name '*.databases.sql.gz' -mtime +7 -delete

I get error because there is no password indicated in the crontab
Code:
2024-07-07T00:05:47 mysql_backup: mysqldump: Got error: 1045: Access denied for user 'root'@'localhost' (using password: NO) when trying to connect

How can i edit the crontab to add my db password?
here is a fake password for the example : Xx123

Thanks.
 
Thanks, immediately means -pXx123 or -p Xx123 ?
 
Back
Top Bottom