Exception: SQLSTATE[HY000] [2002] error on freepbx 13

MySQL database on FreePBX 13 has refused to connect on startup. it generates the error below. I have tried many suggestions on this forum but still not working.
'Exception: SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)::SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) in file /var/www/html/admin/libraries/utility.functions.php on line 204
Stack trace:

  1. Exception->() /var/www/html/admin/libraries/utility.functions.php:204
  2. die_freepbx() /var/www/html/admin/libraries/BMO/Database.class.php:136
  3. PDOException->() /var/www/html/admin/libraries/BMO/Database.class.php:133
  4. PDO->__construct() /var/www/html/admin/libraries/BMO/Database.class.php:133
  5. FreePBX\Database->__construct() /var/www/html/admin/libraries/BMO/FreePBX.class.php:69
  6. FreePBX->__construct() /var/www/html/admin/bootstrap.php:139
  7. require_once() /etc/freepbx.conf:9
  8. include_once() /var/lib/asterisk/bin/fwconsole:12 ’
    Please someone help on how I can repair the database.

I don’t think you’ll have much luck repairing a database. Your best bet is to restore from a backup that you took before the database broke.

have you checked to make sure mysql is running? check your disk space.

I have checked the disk space, there is 65GB free, MySQL is not running ( Daemon not started), and it has refused to start even if i try to start from the command prompt.

What are the errors when you try to start the SQL service?

What happens if you reboot the system?

Hi @kiptoovictor ,

I think that there is a problem with your sock file. you can delete this file /var/lib/mysql/mysql.sock and then restart the MySQL service again (service mysqld restart).

Thank you,

Daniel Friedman
Trixton LTD.