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
DBName=zabbix
DBUser=zabbix
DBPassword=*******
DBPort=3306
# cat zabbix.conf.php
<?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'] = '******';
...
Best Answer
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.