This morning we received this error on one of our 2 LibreNMS installs
SQLSTATE[HY000]  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:
[email protected]:/opt/librenms$ sudo ./validate.php
||Not Connected (0)
Any help is greatly appreciated.
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.
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?