When I add the MySQL template to a host in Zabbix, it always reports an issue that the MySQL Service is down, while it is not.

I've created a new item for one host (the Zabbix server itself which runs its own MySQL server) to test an ODBC connection to MySQL. That works. The next step is to solve the issue "MySQL is down".

  • Open the host configuration (in this case the Zabbix server / localhost)
  • Open items
  • Click one of the MySQL items, like: MySQL slow queries
  • The description field says: It requires user parameter mysql.status[*], which is defined in userparameter_mysql.conf. This is the same for all MySQL items.

I open /etc/zabbix/zabbix_agentd.d/userparameter_mysql.conf, and there it says:

# For all the following commands HOME should be set to the directory that has .my.cnf file with password information.

# Flexible parameter to grab global variables. On the frontend side, use keys like mysql.status[Com_insert].
# Key syntax is mysql.status[variable].
UserParameter=mysql.status[*],echo "show global status where Variable_name='$1';" | HOME=/var/lib/zabbix mysql -N | awk '{print $$2}'

There is no .my.cnf file anywhere on this Amazon Linux system, but there is /etc/my.cnf. Then what is the HOME path? Or is it /var/lib/mysql instead of /var/lib/zabbix (which does not exist)? I've tried that but that doesn't work.


You need to create a .my.cnf file in Zabbix's home directory which has Zabbix's MySQL credentials.


You should have previously created a user for Zabbix.

GRANT USAGE ON *.* TO 'zabbix'@'localhost' IDENTIFIED BY 'Whatever';

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.