SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)::SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

Hola buen día.
Al querer ingresar al pbx desde mi navegador me arroja el siguiente error:

SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)::SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)

Al poner el comando: fwconsole m arroja:

     `Exception: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)::SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in file /var/www/html/admin/libraries/utility.functions.php on line 120
    Stack trace:
      1. Exception->() /var/www/html/admin/libraries/utility.functions.php:120
      2. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:149
      3. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:144
      4. PDO->__construct() /var/www/html/admin/libraries/BMO/Database.class.php:144
      5. FreePBX\Database->__construct() /var/www/html/admin/libraries/BMO/FreePBX.class.php:71
      6. FreePBX->__construct() /var/www/html/admin/bootstrap.php:144
      7. require_once() /etc/freepbx.conf:11
      8. include_once() /var/lib/asterisk/bin/fwconsole:12`

Al entrar a la terminal solo esta arrojando el mensaje:

Firewall was unable to connect to MySQL after 30 seconds.
Check Database!

Y al checar el log: cd /var/log/mariadb/
Me indica: 210710 07:22:36 mysqld_safe mysqld from pid file /var/run/mariadb/mariadb.pid ended

Try systemctl restart mysqld

Me arroja: Failed to restart mysqld.service: Unit not found.

Y con: service mysqld restart
Redirecting to /bin/systemctl restart mysqld.service
Failed to restart mysqld.service: Unit not found.

Try a full system reboot. If that solves it, your system likely has limited resources.

Funcionó reiniciando todo por completo.
Y volver a iniciar MySQL ya que estaba abajo.
Muchas gracias!

I have the same issue. last time I had it running successfully it gave me an error of not enough memory. I am running on a VM, I increased the memory and hard disk space and rebooted multiple time with no success.

If it’s not a resource issue it could be a broken database. I had a disk fail in the RAID a while back and apparently that RAID was not working properly, which meant some random pieces of the PBX were broken. Ended up rebuilding the raid and restoring a backup.

IIRC, there’s an “fwconsole database repair” command that will run a mariadb repair on the mysql database.

There is an error file in the mariadb database directory (servername-err, I think) that will tell you what the problem with the database is “offline”. Check that out and see if that gives you any more clues.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.