The librenms I am running is the VM version.
This post describes the same issue I am having: Error connecting to database. The solution here did not work for me.
Validate.php
librenms@librenms:~$ ./validate.php
Component | Version |
---|---|
LibreNMS | 1.63-43-g305ccf2 |
DB Schema | Not Connected (0) |
PHP | 7.2.14-1+ubuntu16.04.1+deb.sury.org+1 |
Python | 3.5.2 |
MySQL | ? |
RRDTool | 1.5.5 |
SNMP | NET-SNMP 5.7.3 |
====================================
[OK] Composer Version: 1.10.6
[OK] Dependencies up-to-date.
Could not connect to database, check logs/librenms.log.
librenms@librenms:~$
librenms.log
/opt/librenms/poller.php 147 2020-05-08 09:56:31 - 1 devices polled in 1.575 secs
[2020-05-11 10:13:48] production.ERROR: SQLSTATE[HY000] [2002] Connection refused (SQL: select user_id
from users
where (auth_type
= mysql or auth_type
is null or auth_type
= ) and username
= librenms limit 1) {“exception”:"[object] (Illuminate\Database\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (SQL: select user_id
from users
where (auth_type
= mysql or auth_type
is null or auth_type
= ) and username
= librenms limit 1) at /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, Doctrine\DBAL\Driver\PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /opt/librenms/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31, PDOException(code: 2002): SQLSTATE[HY000] [2002] Connection refused at /opt/librenms/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27)
[stacktrace]
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(624): Illuminate\Database\Connection->runQueryCallback(‘select user_id...', Array, Object(Closure)) #1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(333): Illuminate\\Database\\Connection->run('select
user_id…’, Array, Object(Closure))
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2130): Illuminate\Database\Connection->select(‘select `user_id…’, Array, true)
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2118): Illuminate\Database\Query\Builder->runSelect()
#4 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2604): Illuminate\Database\Query\Builder->Illuminate\Database\Query\{closure}()
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2119): Illuminate\Database\Query\Builder->onceWithColumns(Array, Object(Closure))
#6 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(521): Illuminate\Database\Query\Builder->get(Array)
Manually starting mysql:
librenms@librenms:~$ service mysql start
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to start ‘mysql.service’.
Authenticating as: , (librenms)
Password:
==== AUTHENTICATION COMPLETE ===
Job for mysql.service failed because the control process exited with error code. See “systemctl status mysql.service” and “journalctl -xe” for details.
librenms@librenms:~$