SQLSTATE[HY000] [2002] Permission denied Error

Yesterday our LibreNMS server had a power failure. When we try to load the site we now get the following error. SQLSTATE[HY000] [2002] Permission denied. Any thoughts on how to fix this?

Check the grants on your mysql server, that is a direct feedback from mysql that the authenticated user is not allowed to run the query.

Verify that .env contains the correct database credentials. You may need to surround your password with quotes.

Everything in the .env looks good. Tried to start the mysql service with and with the quotes around the password. This is what I get.

Redirecting to /bin/systemctl start mysql.service
Job for mariadb.service failed because a fatal signal was delivered causing the control process to dump core.
See “systemctl status mariadb.service” and “journalctl -xe” for details.

So actually your mysql process crashes, check in the journal and mysql log to see why it happens.

systemctl status mariadb.service
● mariadb.service - MariaDB 10.3 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor pre>
Active: activating (auto-restart) (Result: core-dump) since Mon 2020-04-06 0>
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 15983 ExecStart=/usr/libexec/mysqld --basedir=/usr $MYSQLD_OPTS $_WS>
Process: 15945 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mariadb.service>
Process: 15916 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, sta>
Main PID: 15983 (code=dumped, signal=ABRT)

Apr 06 08:48:42 monitor.xxxxxxx.xxxxx systemd[1]: Failed to start MariaDB 10>

– the configured Restart= setting for the unit.
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx systemd[1]: Stopped LibreNMS SNMP Poll>
– Subject: Unit librenms.service has finished shutting down
– Defined-By: systemd


– Unit librenms.service has finished shutting down.
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx systemd[1]: Started LibreNMS SNMP Poll>
– Subject: Unit librenms.service has finished start-up
– Defined-By: systemd


– Unit librenms.service has finished starting up.

– The start-up result is RESULT.
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: MainThread>
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: MainThread>
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: monitor.ww>
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: monitor.ww>
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: monitor.ww>
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: (2003, "Ca>
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx systemd[1]: librenms.service: Main pro>
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx systemd[1]: librenms.service: Failed w>
lines 6177-6199/6199 (END)
– the configured Restart= setting for the unit.
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx systemd[1]: Stopped LibreNMS SNMP Poller Service.
– Subject: Unit librenms.service has finished shutting down
– Defined-By: systemd


– Unit librenms.service has finished shutting down.
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx systemd[1]: Started LibreNMS SNMP Poller Service.
– Subject: Unit librenms.service has finished start-up
– Defined-By: systemd


– Unit librenms.service has finished starting up.

– The start-up result is RESULT.
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: MainThread(INFO):Configuring LibreNMS service
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: MainThread(INFO):Attempting to load .env from ‘/opt/librenms/.env’
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: monitor.xxxxxxx.xxxxxx(INFO):Attaching signal handlers on thread monitor.xxxxxxx.xxxxxx
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: monitor.xxxxxxx.xxxxxx(INFO):Using pure python SQL client
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: monitor.xxxxxxx.xxxxxx(CRITICAL):ERROR: Could not connect to MySQL database! (2003, "Can’t connect to MySQL server on ‘localhost’ ([Errno 1>
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx librenms-service.py[18651]: (2003, “Can’t connect to MySQL server on ‘localhost’ ([Errno 111] Connection refused)”)
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx systemd[1]: librenms.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 06 08:50:57 monitor.xxxxxxx.xxxxxx systemd[1]: librenms.service: Failed with result 'e