Page 1 of 1
Unable to connect to database
Posted: Tue Feb 05, 2019 11:03 am
by andrewatmacys
I have a Nagios installation on version 5.4.13 and it's running a mariadb database, but I am unable to connect to it from outside the server. I have run the repair script and have looked at the config file in etc/my.cnf and found nothing indicating that it shouldn't be able to accept outside connections. It was working until recently as far as I am aware, so I'm not sure what happened to cause this shut out to happen. Is there any other place that I can look to see if it isn't accepting connections, or is there any way to check if it's just broken? The repair completed successfully so I don't think it's broken, and the firewall rules shouldn't have changed from what they were so I don't think that's it. Any help is appreciated! Thanks!
Re: Unable to connect to database
Posted: Tue Feb 05, 2019 11:30 am
by andrewatmacys
This is the error we are getting when attempting to connect.
Re: Unable to connect to database
Posted: Tue Feb 05, 2019 12:38 pm
by npolovenko
@andrewatmacys, On the MySQL server open the /etc/my.cnf file and add the following lines to the [mysqld] section.
bind-address=<IP address of this computer, the computer with MySQL or MariaDB>
port=3306
In this case, I used port 3306, most common one.
Then restart mariadb with:
service mariadb restart
On the mysql server sign in to the database and run this command:
GRANT ALL ON *.* TO root@'<ip_of_the_windows_server>' IDENTIFIED BY '<mysql_root_password>';
Re: Unable to connect to database
Posted: Tue Feb 05, 2019 2:54 pm
by andrewatmacys
I'll update as soon as I can get root permission to modify that file.
Re: Unable to connect to database
Posted: Tue Feb 05, 2019 4:12 pm
by npolovenko
@andrewatmacys, Sounds good.
Re: Unable to connect to database
Posted: Wed Feb 06, 2019 2:53 pm
by andrewatmacys
Unfortunately we are still running into the same issue after adding the lines above. Just to make sure, the IP to be added is the one for the server that the DB is on, which is the Nagios server, correct?
Re: Unable to connect to database
Posted: Wed Feb 06, 2019 3:04 pm
by andrewatmacys
Looking at a separate instance of Nagios that we're running the config file in question does not have the above entries, if that helps.
I can send both if needed.
Re: Unable to connect to database
Posted: Wed Feb 06, 2019 4:18 pm
by andrewatmacys
I have created a support ticket at the request of my team, #661010. thanks!
Re: Unable to connect to database
Posted: Wed Feb 06, 2019 4:35 pm
by npolovenko
@andrewatmacys, Please sign in to the mysql server on the XI server:
mysql -u root -pnagiosxi
And then run this query:
GRANT ALL ON *.* TO 'root'@'ma000xbsql58a.federated.fds' IDENTIFIED BY 'nagiosxi';
This should fix your issue.
If your nagios XI root DB password is not 'nagiosxi' you need to change it in the command -> IDENTIFIED BY 'nagiosxi'.
Re: Unable to connect to database
Posted: Thu Feb 07, 2019 10:30 am
by andrewatmacys
That worked, thank you! We can close the thread.