FreePBX 16 Crashed Database - MySQL Server has Gone Away/Connection Refused

Friends, good afternoon!
I have a serious problem with my PBX after a problem with its virtualizer host (Hyper-V 2022, Windows 10).

My PBX server had some snapshots, and in an attempt to merge these snapshots with the main disk, the VM had problems - however I made a backup of the folder with the main hard disk and its snapshots (avhdx). However, when running the last saved snapshot, I get the message SQLSTATE[HY000] [2002] Connection refused::SQLSTATE[HY000] [2002] Connection refused and also the error “MySQL server has gone away”.

When loggin in the CLI i receive this:

login as: root
[email protected]’s password:
Last login: Tue Jun 6 14:24:52 2023 from 192.168.1.22
Exception: SQLSTATE[HY000] [2002] Connection refused::SQLSTATE[HY000] [2002] Connection refused in file /var/www/html/admin/libraries/utility.functions.php on line 120

Caused by
PDOException: SQLSTATE[HY000] [2002] Connection refused in file /var/www/html/admin/libraries/BMO/Database.class.php on line 144
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:150
  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:77
  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
    Exception: SQLSTATE[HY000] [2002] Connection refused::SQLSTATE[HY000] [2002] Connection refused in file /var/www/html/admin/libraries/utility.functions.php on line 120

Caused by
PDOException: SQLSTATE[HY000] [2002] Connection refused in file /var/www/html/admin/libraries/BMO/Database.class.php on line 144
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:150
  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:77
  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
    [root@freepbx ~]#

Apparently the problem is being caused by the machine “not understanding” who it is - I realized that my FOP2 is also showing a license error, as if it were a hostname error.
I’m already creating another server (on another virtualizer, with better usage practices), but I urgently need this SQL to run so that I can at least use the backup module or bulk handler to minimize losses.
At this moment the PBX is stopped - without GUI, asterisk does not initialize itself (only after giving service asterisk restart it starts, but we cannot do much without SQL running)… has anyone experienced a similar case?
Please help me

What are the mysql errors? that’s where I would start. Look in /var/log/messages or if you have a mysql.error log…

Probably not what you want to hear, but do you have FreePBX config / Backup configs? (I dump mine every night), it might be simpler to install fresh on the newest version and restore your config. That way everything is fixed and you have all of your settings, and you know everything is going to work. I’m a paranoid Android so I backup my VM and do backups using the built-in backup feature of FreePBX. I’ve restored it to new versions several times and it’s always been dependable.

I lost everything, but luckily I found an old backup that helped me with the rebuilding process. :smile:

Wow, lucky. Hope you have regular backups now :wink: Glad everything worked out :slight_smile:

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