Is your Zabbix tries to connect to the wrong database?
This guide will help you.
Zabbix is a server/client network monitoring system with many features with Zabbix Server supporting MySQL.
What to do when Zabbix tries to connect to the wrong database ?
Recently, one of our customers approached us saying that he has a Zabbix server installed on a CentOS 7 remote server, but can’t get it running.
Here is the error message that he can see in /var/log/zabbix/:
[Z3001] connection to database 'zabbix' failed:  Access denied for user 'zabbix'@'localhost' (using password: YES)
The customer has a database for Zabbix, but it is named zabbixdb, not Zabbix (as in the error message)
Now let's see how our Support Experts help our customers resolve this error.
We suggested restarting the service and check if it still tries to use the Zabbix database in the logs.
In case, if it still uses the Zabbix database then we suggested checking if there are any duplicate DBName entries in zabbix_server.conf.
To do this, use the below command:
grep DBName /etc/zabbix/zabbix_server.conf
Removing the duplicate entries must resolve the error.
Also, we suggest to re-check the Zabbix configuration file present in /etc/zabbix/web/zabbix.conf.php.
The database credentials will be present at a lower level in the file.
So make sure not to add them at the top as it can be overwritten in memory.
So, make sure to check those variables present at the lower level in the configuration file.