NEED MORE INFO FIX: MySQL DB Error

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
WE had some sort of power outage last night and looks like the UPSes didn't keep everything up. THat might explain why a call via vitelity got rejected. When I tried to login tonight I got this:

FATAL ERROR

DB Error: connect failed

Trace Back

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

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

/var/www/html/admin/config.php:61 require()
[0]: /var/www/html/admin/bootstrap.php

here's what I have:

PBX in a Flash PURPLE Status Program
qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
lqqqqqqqqqqqqqqqqqqqSYSTEM INFORMATION *VERIFIED*qqqqqqqqqqqqqqqqqqqqqk
x Asterisk = OFFLINE | Dahdi = ONLINE | MySQL = OFFLINE x
x SSH = ONLINE | Apache = ONLINE | Iptables = ONLINE x
x Fail2ban = ONLINE | Internet = ONLINE | Ip6Tables = ONLINE x
x Disk Free = ADEQUATE| Mem Free = ADEQUATE| NTPD = ONLINE x
x Postfix = ONLINE | Samba = ONLINE | Webmin = ONLINE x
x Ethernet0 = ONLINE | Ethernet1 = N/A | Wlan0 = N/A x
x x
x PIAF Installed Version = 2.0.6.4 under *HARDWARE* x
x FreePBX Version = 2.9.0.14 x
x Running Asterisk Version = UNKNOWN x
x Asterisk Source Version = 1.8.20.1 x
x Dahdi Source Version = 2.6.2 x
x Libpri Source Version = 1.4.12 x
x IP Address = 10.161.51.10 on eth0 x
x Operating System = CentOS release 6.4 (Final) x
x Kernel Version = 2.6.32-358.2.1.el6.i686 - 32 Bit x
x Incredible PBX 3 Version = 3.1.0 x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj



root@pbx:~ $
thoughts? thanks leon
 

atsak

Guru
Joined
Sep 7, 2009
Messages
2,381
Reaction score
436
Your DB is corrupt :banghead: it would seem, at a minimum, and maybe some of the rest of the hard drive.

Run fsck first, then do some googling for repairing a MySQL database. You can try service mysqld start as well then log in /var/log/messages to see if you can figure out why it isn't starting or which table is corrupt.

PS I am not a Linux experts these instructions should be expounded on and perhaps corrected by others.
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
i'm definitely not a linux guru...but it makes sense.

I'm going to try a reboot of the box since stopping and restarting the daemon fails

root@pbx:~ $ service mysqld start
Another MySQL daemon already running with the same unix socket.
Starting mysqld: [FAILED]
root@pbx:~ $ service mysqld stop
Stopping mysqld: [ OK ]
root@pbx:~ $ service mysqld start
Another MySQL daemon already running with the same unix socket.
Starting mysqld: [FAILED]
root@pbx:~ $

ok that (reboot) failed....:-(
 

tm1000

Schmoozecom INC/FreePBX
Joined
Dec 1, 2009
Messages
1,360
Reaction score
78
No. Don't just jump to conclusions. You know nothing about his hard drive or system. This is an error with an upstream update from Oracle where-as if there is a power outage mysql doesn't remove the socket file on a reboot from a power outage (or you pulling the plug) and instead thinks it's already running when it's not. This is fixed in the FreePBX distro, but for other distros they will need to just:

Code:
service mysqld stop
rm -Rf /var/lib/mysql/mysql.sock
service mysqld start
Your DB is corrupt :banghead: it would seem, at a minimum, and maybe some of the rest of the hard drive.

Run fsck first, then do some googling for repairing a MySQL database. You can try service mysqld start as well then log in /var/log/messages to see if you can figure out why it isn't starting or which table is corrupt.

PS I am not a Linux experts these instructions should be expounded on and perhaps corrected by others.
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
Ok thanks I'll try it in the morning

Leon
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
That works thanks. Is this in new distro?

Leon
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
looks like we had a power failure and my UPS batteries need replacing

got this again

FATAL ERROR

DB Error: connect failed

Trace Back

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

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

/var/www/html/admin/config.php:61 require()
[0]: /var/www/html/admin/bootstrap.php


guess I have to do what I did last time?

leon

 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
this time the script worked but I had to amportal restart twice

leon
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
hi guys this happened again with another box

qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq
lqqqqqqqqqqqqqqqqqqqqqqqqSYSTEM INFORMATIONqqqqqqqqqqqqqqqqqqqqqqqqqqqk
x Asterisk = ONLINE | Dahdi = ONLINE | MySQL = ONLINE x
x SSH = ONLINE | Apache = ONLINE | Iptables = ONLINE x
x Fail2ban = ONLINE | Internet = ONLINE | Ip6Tables = ONLINE x
x Disk Free = ADEQUATE| Mem Free = ADEQUATE| NTPD = ONLINE x
x Postfix = ONLINE | Samba = ONLINE | Webmin = ONLINE x
x Ethernet0 = ONLINE | Ethernet1 = N/A | Wlan0 = N/A x
x x
x PIAF Installed Version = 2.0.6.4 under *HARDWARE* x
x FreePBX Version = 2.11.0.36 x
x Running Asterisk Version = 11.6.0 x
x Asterisk Source Version = 11.6.0 x
x Dahdi Source Version = 2.7.0.1 x
x Libpri Source Version = 1.4.14 x
x IP Address = 10.196.4.10 on eth0 x
x Operating System = CentOS release 6.4 (Final) x
x Kernel Version = 2.6.32-358.23.2.el6.i686 - 32 Bit x
x Incredible Version = 11.7 x
mqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj


the script fixed it -- can this be put in as a script that runs on boot?

thanks leon
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
thanks...I'd really like to see things like this part of the distro instead of having to add stuff piecemeal. TO me it makes perfect sense.

leon
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
This is a most unusual occurrence unless you have hardware issues. In 8 years I've never once seen it happen.
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
Hey ward. This is on two different boxes. One an older dell with real HD (home). The other newer box with ssd (synagogue ). In both cases I believe the boxes were rebooted with power down. One at home due to ups battery fail. Synagogue they just did it.

I'm trying to get them not to do that to at least do a C-A-D but still having a script to clear this anomoly (sp?) seems to make sense to me. Through I out my embedded software career if always look at failure modes and how to program for them and understand them

Leon
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
If damage to this file is all you experience after a power cut on a Linux box, you were damn lucky.

Having said that, if you want this run each time your server boots, just issue these commands to add it to the rc.local file ABOVE the exit 0 final line. Edit rc.local and MOVE the exit 0 command to the bottom of the file!!

Code:
echo "service mysqld stop" >> /etc/rc.d/rc.local
echo "rm -Rf /var/lib/mysql/mysql.sock" >> /etc/rc.d/rc.local
echo "service mysqld start" >> /etc/rc.d/rc.local
 

atsak

Guru
Joined
Sep 7, 2009
Messages
2,381
Reaction score
436
If damage to this file is all you experience after a power cut on a Linux box, you were damn lucky.

In this day and age, I must respectfully disagree. All modern operating systems almost always recover from unexpected power outages IME. There may well be a little data loss, but I would consider it unlucky to have anything more than a minor inconvenience. No excuse not to have a UPS of course, but unlikely with recent file systems (especially journaling ones) to have a major catastrophe.
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
UPSes at both sites. At my site I need to replace battery. But I agree and said before this should be in the distro. Thanks again. Leon
 

atsak

Guru
Joined
Sep 7, 2009
Messages
2,381
Reaction score
436
UPSes at both sites. At my site I need to replace battery. But I agree and said before this should be in the distro. Thanks again. Leon


Ya, I've gotten a lot more vigilant about recording when I install a UPS and putting a calendar entry (literally) to replace the battery proactively after 3 years unless it's failed before that. So far so good.
 

wa4zlw

Member
Joined
Feb 14, 2008
Messages
845
Reaction score
22
hi folks after another power blip this morning and not having time to get things swapped out; I tried Wards script and it fails:


root@pbx:~ $ echo "service mysqld stop" >> /etc/rc.d./rc.local
-bash: /etc/rc.d./rc.local: No such file or directory
root@pbx:~ $ echo "rm -Rf /var/lib/mysql/mysql.sock" >> /etc/rc.d./rc.local
-bash: /etc/rc.d./rc.local: No such file or directory
root@pbx:~ $ echo "service mysqld start" >> /etc/rc.d./rc.local
-bash: /etc/rc.d./rc.local: No such file or directory

not being a linux guru, I'm stumped.

thanks leon
 

wardmundy

Nerd Uno
Joined
Oct 12, 2007
Messages
19,168
Reaction score
5,199
Remove (typo) period after rc.d. in each line. Sorry.
 

Members online

No members online now.

Forum statistics

Threads
25,781
Messages
167,507
Members
19,201
Latest member
troutpocket
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top