Bacula-users

[Bacula-users] mysqldump not working due to missing password

2017-01-05 02:48:40
Subject: [Bacula-users] mysqldump not working due to missing password
From: Stefan Kiehne <stkiehne AT gmail DOT com>
To: bacula-users <bacula-users AT lists.sourceforge DOT net>
Date: Thu, 5 Jan 2017 08:47:08 +0100
Hi guys,

I have a ClientRunBeforeJob directive that makes a dump of each database (using mysqldump) before the backup.

ClientRunBeforeJob = "sh -c 'databases=`mysql -u root -e \"SHOW DATABASES;\" | grep -Ev \"(Database|information_schema|performance_schema)\"`; rm -f /var/spool/bacula/*.sql && for db in $databases; do mysqldump --defaults-extra-file=/var/spool/bacula/.my.cnf --opt --events --databases $db > /var/spool/bacula/$db.sql; done && unset databases'"

I added the option --defaults-extra-file=/root/.my.cnf because it neede a password but since the bacula user couldn't read the file in that directory it failed. So I moved the file to /var/spool/bacula/.my.cnf and changed the ClientRunBeforeJob accordingly. Just checked and it still didn't work (ClientRunBeforeJob: ERROR 1045 (28000): Access denied for user 'x'@'y' (using password: NO). I can log in to mysql as bacula with no problem (using 'sudo -u bacula mysql') So what am I missing here?

Also when it fails, the job still continues without error which is why I hadn't caught this problem before.

Hope you can help me figure this one out
Regards Stefan
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
<Prev in Thread] Current Thread [Next in Thread>