Fatal Error with FreePBX

Hi,

I had installed FreePBX on an eMachines (AMD processor) desktop and everything was working well. I went away for business for a few days and when I returned, this is the message that is showing:

FATAL ERROR

DB Error: connect failed

Trace Back

/var/www/html/admin/libraries/db_connect.php:63 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

Any suggestions or what I can do to fix this?

You need to figure out why FreePBX can’t connect to the database. Is MySQL running? Did the password change?

Yes, MySQL is running and the password hasn’t changed.

Well the error says FreePBX can’t connect using the supplied credentials.

Hi Skyking,

Could you please help solve my pblm? I got the same fatal error and as a beginner in freepbx, it is not easy to find it by myself. Thanks for your help.
FATAL ERROR
DB Error: connect failed
Trace Back
/var/www/html/admin/libraries/db_connect.php:63 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:95 include_once()
[0]: /etc/freepbx.conf

Where does this come up, when you click apply config in FreePBX?

There are only two DV’s One called asterisk and the other asteriskcdrdb

The asterisk db password is in /etc/freepbx.conf and asteriskcdrdb is changed in advanced settings.

Passwords don’t change on their own, someone had to do something on the system.

It comes when i click on “FreePBX Administration” on my browser pointing to http://172.20.10.3.

I’m trying to run this GUI: https://wiki.asterisk.org/wiki/display/AST/Installing+AsteriskNOW.

Just inform you that I’m a newe…pardon if some of my questions seems too low…

Thanks for your help.

Had the same issue and a newbie (so may not be right or a good answer)… but found this on another website and it helped me
service mysqld stop
mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
service mysqld start

I tried “service mysqld stop” ==>OK
"service mysqld start"==>FAILED
because: “Another MySQL daemon is already running with the same unix socket”.

Does someone already got the same pblm ? Thanks for your help.

So you have another instance of mysql running? Is this intentional?

No. It is not intentional. Maybe it is related to my VM Vitualbox on which i installed the asterisknow ?
Unless Asterisknow, nothins else is installed on it :(.
thanks for yur help.

I just dealt with this error after my virtual machine shut down ungracefully. mariniar’s suggestion to rename the mysqld.sock file worked for me. Login to the virtual machine’s console as the root user and execute these three commands exactly:

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

Thanks you so much Guys ! It works :slight_smile: !!
Special thanks to felgercarb1329 and mariniar for you the working code.

hi
sorry for my english.

i have the same problem, and the solution is the same, but why happens?
i have the freepbx on a esxi enviroment, and when the server lost the power, the pbx not start automatycally, i have to connect via ssh and put these commands.

everytime that the server lost the power, not autostart, i tested 3 or 4 times and allways fail

there is a solution for this problem?
thanks for all

Jamiroo,

When MySQL, the PBX’s database server, crashes unexpectedly, as with a power outage to the computer it’s running on, it leaves this mysql.sock file behind. The file is created as a normal and necessary part of MySQL’s operation, it’s called a “socket” (see http://en.wikipedia.org/wiki/Unix_file_types#Socket for details). If MySQL is stopped gracefully, this file is deleted automatically.

As I replied to markbhai, if you expect your system to operate properly, power protection is necessary (along with using the server’s power button appropriately).

I have the same problem if the system is closed down dis-gracefully (i.e. power cut or just pressing the PC reset button).

Clearly this is not suitable for a production system…I was wondering (as a newbie) if it was possible to add the commands

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

to a startup routine so that the mysql.sock file was renamed everytime the server started up?

Will this cause any other problems.

This way the problem will fix itself?

Thanks
Mark.

If this is truly a production system, then it should be on conditioned power, at least a battery backup with suitable runtime reserves. In my case, I’m running a system at home and do have a battery backup with about 30 minutes of reserve, enough for the most common outages. My recent outage lasted four hours, though, and I haven’t configured my systems to do an auto-shutdown when the battery unit reaches a predetermined reserve level (which should be configured for a “production” system).

If proper power protection, as well as protecting the power switch, is in place, your proposed script should be unnecessary. If you aren’t able to provide that, then your script would be an acceptable workaround (personally, I’d test for the existence of the file before the rename command; search for “bash file test operators” in your favorite search engine for details).