Mk_mysql plugin simply ignores my mysql.cfg

That is not the output of the command I suggested. However. I suspect another config file overwrites the settings given in /etc/check_mk/mysql.cfg.

Run the following commands as root:

export MK_CONFDIR=/etc/check_mk
strace mysqladmin --defaults-extra-file="$MK_CONFDIR"/mysql.cfg ping |& grep "^stat"

On my machine this gives the following output (truncated):

...
stat("/etc/my.cnf", 0x7fffa309ed90)     = -1 ENOENT (No such file or directory)
stat("/etc/mysql/my.cnf", {st_mode=S_IFREG|0644, st_size=682, ...}) = 0
stat("/etc/mysql/conf.d/mysql.cnf", {st_mode=S_IFREG|0644, st_size=8, ...}) = 0
stat("/etc/mysql/conf.d/mysqldump.cnf", {st_mode=S_IFREG|0644, st_size=55, ...}) = 0
stat("/etc/mysql/mysql.conf.d/mysqld.cnf", {st_mode=S_IFREG|0644, st_size=3052, ...}) = 0
stat("/etc/mysql/mysql.conf.d/mysqld_safe_syslog.cnf", {st_mode=S_IFREG|0644, st_size=21, ...}) = 0
stat("/etc/check_mk/mysql.cfg", {st_mode=S_IFREG|0640, st_size=261, ...}) = 0
stat("/etc/check_mk/mysql.local.cfg", 0x7fffa309a810) = -1 ENOENT (No such file or directory)
stat("/root/.my.cnf", 0x7fffa309ed90)   = -1 ENOENT (No such file or directory)
stat("/root/.mylogin.cnf", 0x7fffa309ed90) = -1 ENOENT (No such file or directory)
...

That is: various config files are read (or tried to be read) by mysqladmin (and mysql as well), some of which don’t exist.

But if you have a file /root/.my.cnf or /root/.mylogin.cnf then they will overwrite the settings made in “previous” files. Check these two files. I suspect they exist and contain a section [client] with username=root.

1 Like