This morning we received this error on one of our 2 LibreNMS installs
SQLSTATE[HY000] [1045] Access denied for user ‘librenms’@‘localhost’ (using password: NO)
I’ve looked through the various guidance from other posts and the .ENV and config.php files contain a username and password that I am able to manually login to MySQL with.
When I attempt to validate the environment I receive this:
icingaadmin@icingaadmin-virtual-machine:/opt/librenms$ sudo ./validate.php
Component
Version
LibreNMS
1.64.1-345-g52dd406c3
DB Schema
Not Connected (0)
PHP
7.2.24-0ubuntu0.18.04.6
Python
3.6.9
MySQL
?
RRDTool
1.7.0
SNMP
NET-SNMP 5.7.3
====================================
Any help is greatly appreciated.
Thanks
W
For some reason LibreNMS was unable to automatically update /opt/librenms/.env with your database credentials. Please do so manually.
This was all working fine prior to the weekend. Nothing has changed on the system to suggest a password was changed.
I checked the .env file and could see it populated with credentials. I also confirmed the same on the config.php file.
I even attempted to swap the credentials in and out of the two files incase there was a mismatch but this didn’t appear to work.
Thanks
W
Chas
30 June 2020 17:14
4
On your working instance, is it running the same version of Librenms? can you post the validate.php on your instance which is working?
Did you check file permissions?
using password: NO
means it is not using any password. This seems to indicate DB_PASSWORD is not set.
Oddly - The initial issue seemed to resolve itself for a couple of days. Then following a reboot the error re-occurred.
Un-commenting the DB_Password in the .ENV file appears to resolve it.
How was this working for months without the password? Is it a daily change that has been pulled down?
Thanks
W