"Error connecting to database" after changing CCM settings

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
cwscribner
Posts: 316
Joined: Thu Mar 31, 2011 9:54 am
Location: Patten, ME
Contact:

"Error connecting to database" after changing CCM settings

Post by cwscribner »

Hi all.

I recently attempted to offload MySQL to a separate server. I changed the IP address in the Config Manager Settings to the server holding the new MySQL database and now get an "Error connecting to database" message in the CCM. How can I fix this?
Last edited by cwscribner on Mon Sep 19, 2011 2:15 pm, edited 1 time in total.
User avatar
nscott
Posts: 1040
Joined: Wed May 11, 2011 8:54 am

Re: "Error connecting to database" after changing CCM settin

Post by nscott »

The biggest cause of this is:

Bad password / Firewall settings

Can you drop down the terminal and try some stuff out:

In these examples I'm going to use the variables REMOTEIP will be the IP of the MySQL server you offloaded to, PASSWORD, USERNAME are the password and username for the REMOTE MySQL server, and NAGIOS is the name of the NAGIOS database and NAGIOSQL is the name of the nagiosql database

mysql -u USERNAME -p PASSWORD -h REMOTEIP

Does this connect?

mysql -u USERNAME -pPASSWORD -h REMOTEIP NAGIOS
mysql -u USERNAME -pPASSWORD -h REMOTEIP NAGIOSQL

Does these connect?

If none of those connect look at the firewall/authentication.
Nicholas Scott
Former Nagios employee
cwscribner
Posts: 316
Joined: Thu Mar 31, 2011 9:54 am
Location: Patten, ME
Contact:

Re: "Error connecting to database" after changing CCM settin

Post by cwscribner »

Both of those successfully connect.
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: "Error connecting to database" after changing CCM settin

Post by mguthrie »

The DB settings for the CCM may be trying to connect with the settings located in the following file:
/var/www/html/nagiosql/config/settings.php

Update the credentials and address in this file and see if it connects.
cwscribner
Posts: 316
Joined: Thu Mar 31, 2011 9:54 am
Location: Patten, ME
Contact:

Re: "Error connecting to database" after changing CCM settin

Post by cwscribner »

That fixed it. Thanks!
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: "Error connecting to database" after changing CCM settin

Post by mguthrie »

Good deal!
Locked