FATAL ERROR DB Error: connect failed

Hi guys, please help suddenly when I access our freepbx web portal this error displays

FATAL ERROR

DB Error: connect failed

Trace Back

/var/www/html/admin/libraries/db_connect.php:82 die_freepbx()
[0]: DB Error: connect failed

/var/www/html/admin/bootstrap.php:98 require_once()
[0]: /var/www/html/admin/libraries/db_connect.php

/etc/freepbx.conf:9 require_once()
[0]: /var/www/html/admin/bootstrap.php

/var/www/html/admin/config.php:109 include_once()
[0]: /etc/freepbx.conf

Tried to fix it using this following command below as I read the forums but there is an error when I am typing the second line and when I enter it…
(mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak) - It says

mv’ cannot stat ’ /var/lib/mysql/mysql.sock’: No such file or directory

service mysqld stop
mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
service mysqld start

please help me on this one…

Nobody can help you until you explain exactly how you you installed FreePBX, on what platform, by what method.

If mysql is as a service, running and the the asterisk user you defined has access to the tables (asterisk and asteriskcdrdb) with the password you chose.

It rarely fails if you completely follow the recipe without deviation.