I had a successful zabbix 3.4 server running in an LXC container (CentOS7 base) with an embedded database for month, and I decided to join all container databases on my server into one. So I have dumped the zabbix database, moved it to the container, made its 3306 port available. From the Zabbix container, I can successfully log into the mysql using the command-line. The server backend seems to be able to after updating /etc/my.cnf

Problem is the frontend still tries to contact the mysql through a local socket :

Error connecting to database: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

I have tried to rename /usr/share/zabbix/conf/zabbix.conf.php.example to /usr/share/zabbix/conf/zabbix.conf.php and put database configuration in it but it doesn't change anything. I have tried to grep through the whole /usr/share/zabbix directory for my database credentials without success.

Where are stored the frontend database configurations ? Or am I doing anything wrong ?

Configurations :

# grep ^DB /etc/zabbix/zabbix_server.conf 
DBHost=mysql.host #local host name

# cat zabbix.conf.php 
// Zabbix GUI configuration file.
global $DB;
$DB['TYPE']                             = 'MYSQL';
$DB['SERVER']                   = 'mysql.host';
$DB['PORT']                             = '3306';
$DB['DATABASE']                 = 'zabbix';
$DB['USER']                             = 'zabbix';
$DB['PASSWORD']                 = '******';

Do you have /etc/zabbix/zabbix.conf.php, /etc/zabbix/web/zabbix.conf.php or a similarly located/named file? In general, check the /etc/zabbix/ directory, as your packages seem to prefer it for configuration files.

  • well found ! it was there indeed. I'll try to find a way to notify Zabbix team to add this to their documentation (as they package the RPMs themselves) – mveroone May 16 '17 at 8:23
  • 1
    I was sure it is documented somewhere, but indeed could not find it in the package section of the manual. Please do report it as a bug against the documentation. – Richlv May 16 '17 at 12:45
  • BR : support.zabbix.com/browse/ZBX-12188 – mveroone May 16 '17 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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