Sqlstate hy000 2002

After the last update, we had performance issues. Prior to that it was running fine. First was some slow down then no web gui. Following some advice I did the swap php and optimize. The server ran ok for a couple of days then crashed. I finally got Centos to boot but when logging in to Librenms got sqlstate hy000 2002 error. When running the validate:
bash-4.2$ ./validate.php

Component Version
LibreNMS 1.43-110-gd9b4fb5
DB Schema ?
PHP 7.1.21
MySQL ?
RRDTool 1.4.8
SNMP NET-SNMP 5.7.2

====================================

[OK] Composer Version: 1.7.2
[OK] Dependencies up-to-date.
[FAIL] Error connecting to your database.
[WARN] Could not check poller/discovery, db is not connected.
[WARN] Your install is over 24 hours out of date, last update: Thu, 20 Sep 2018 20:43:36 +0000
[FIX] Make sure your daily.sh cron is running and run ./daily.sh by hand to see if there are any errors.
bash-4.2$

Fails to connect to the database.

suggestions?

tk

A couple of more items; daily.sh doesn’t work of course, can’t connect to database.
A tail on librenms.log gives me:
[2018-09-24 16:59:01] production.ERROR: PDOException: SQLSTATE[HY000] [2002] Connection refused in /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
Stack trace:
#0 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(68): PDO->__construct(‘mysql:host=loca…’, ‘librenms’, ‘tpl2Libreact’, Array)
#1 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(44): Illuminate\Database\Connectors\Connector->createPdoConnection(‘mysql:host=loca…’, ‘librenms’, ‘tpl2Libreact’, Array)
#2 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php(24): Illuminate\Database\Connectors\Connector->createConnection(‘mysql:host=loca…’, Array, Array)
#3 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php(183): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#4 [internal function]: Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors{closure}()
#5 /opt/librenms/vendor/laravel/framework/src/Illuminate/Database/Connection.php(883): call_user_func(Object(Closure))
#6 /opt/librenms/LibreNMS/DB/Eloquent.php(110): Illuminate\Database\Connection->getPdo()
#7 /opt/librenms/includes/init.php(108): LibreNMS\DB\Eloquent::isConnected()
#8 /opt/librenms/alerts.php(31): require(’/opt/librenms/i…’)
#9 {main}

Well, a little more on the problem:
[root@f2mlibre etc]# systemctl status mariadb.service
● mariadb.service - MariaDB database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2018-09-24 18:40:46 GMT; 1min 8s ago
Process: 10840 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=1/FAILURE)
Process: 10839 ExecStart=/usr/bin/mysqld_safe --basedir=/usr (code=exited, status=0/SUCCESS)
Process: 10806 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS)
Main PID: 10839 (code=exited, status=0/SUCCESS)

Sep 24 18:40:37 server.net systemd[1]: Starting MariaDB database server…
Sep 24 18:40:38 server.net mariadb-prepare-db-dir[10806]: Database MariaDB is probably initialized in /var/lib/mysql already, nothing is done.
Sep 24 18:40:38 server.net mariadb-prepare-db-dir[10806]: If this is not the case, make sure the /var/lib/mysql is empty before running mariadb-prepare-db-dir.
Sep 24 18:40:39 server.net mysqld_safe[10839]: 180924 18:40:39 mysqld_safe Logging to ‘/var/log/mariadb/mariadb.log’.
Sep 24 18:40:39 server.net mysqld_safe[10839]: 180924 18:40:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Sep 24 18:40:46 server.net systemd[1]: mariadb.service: control process exited, code=exited status=1
Sep 24 18:40:46 server.net systemd[1]: Failed to start MariaDB database server.
Sep 24 18:40:46 server.net systemd[1]: Unit mariadb.service entered failed state.
Sep 24 18:40:46 server.net systemd[1]: mariadb.service failed.
You have new mail in /var/spool/mail/root

And it won’t start. I’m about at the end of what I know how to do here.
Anyone have ideas?

Tk

Maybe you have mysql and mariadb installed?

If you run ps ax | grep mysql do you have a mysql running proc?

Yes, they are installed and were running just fine before the update. After searching a lot, it looks like the database has become corrupted. I’m now trying to see if there is a way to figure out exactly what is damaged and recover. Otherwise I guess I might as well trash the whole thing. What a pain.

tk