- edited description
mysql 5.6 "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)"
Following script (replication check) produces STATUS FAILED in monit. Needless to say that the script works perfect executed in a shell.
#!/bin/sh
CNT=`mysql --login-path=mysqlalias -e "SHOW SLAVE STATUS\G" | grep 'Slave_SQL_Running: ' | awk '{ if ($2 == "Yes") print 1; else print 2 }'`
echo $CNT
exit $CNT
Monit:
check program mysql-replication with path "/etc/monit/mysql_check_replication.sh"
if status != 1 then alert
Looks like monit doesn't like the way mysql is handling user login through the mysql_config_editor set --login-path=mysqlalias --user=root --password --host=localhost method. BTW the old method like mysql -u root -ppass does not work anymore for my scripts cause the genius at mysql put a nag warning message for all commands providing the -ppass in clear. Oh well!
Comments (6)
-
repo owner -
repo owner -
assigned issue to
-
assigned issue to
-
repo owner Is monit running as the same user when you try the command line or different one? (for example "root"?)
The script also uses /bin/sh - if you run it from command line, it is likely that you use /bin/bash and it may initialized the environment variables from bash-specific files.
The script uses relative paths, when executed via monit it may have different environment. Please can you try to modify the script to use absolute paths? For example:
#!/bin/bash CNT=`/usr/bin/mysql --login-path=/root/mysqlalias -e "SHOW SLAVE STATUS\G" | grep 'Slave_SQL_Running: ' | awk '{ if ($2 == "Yes") print 1; else print 2 }'` echo $CNT exit $CNT
-
reporter What a dork I am. Forgot that mysqlalias is a NAME and not a file. Changing sh to bash did the trick. Thank you very much for your great support.
-
repo owner - changed status to resolved
-
repo owner - removed version
Removing version: 5.14 (automated comment)
- Log in to comment