I created a bash script that backs up my database,
It basically just runs these commands:
DB=/home/linuxuser/backups/backupfilename.sql.gz mysqldump --login-path=local db_name | gzip > "$DB"
When I run it from the command line as
linuxuser or as
root, it works.
But when I add it to cron.d, I get a mysql error and the
sql.gz file is empty.
mysqldump: Got error: 1045: Access denied for user 'linuxuser'@'localhost' (using password: NO) when trying to connect
(I get the same type of error when running the cron as root, too)
How can I fix this? Could it be a problem with environment variables?
I tried changing:
... but that did not help.