Page 1 of 1

Can't connect MySQL server AND Can't call "prepare_cach

Posted: Wed May 10, 2006 8:32 pm
by Eklectick
Hi

After a little over a year of flawless working with ZM suddenly this morning the Console showed up with a strange error (something about a MySql error, sorry didnt have the chance to copy/paste).

So after the "mandatory" reboot I found that ZM just didnt startup.

A "service zm start" at prompt gives out the following:

Code: Select all

Starting ZoneMinder: DBI connect('database=zm;host=localhost','zm_admin',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) at /usr/local/bin/zmpkg.pl line 49
Can't call method "prepare_cached" on an undefined value at /usr/local/bin/zmpkg.pl line 52.
BEGIN failed--compilation aborted at /usr/local/bin/zmpkg.pl line 60.
So what do you fellows think? Is there something I could try to do to fix what I think is a corrupt database or should I really be thinking on a reinstall :-(

I am not a MySql geek so I would appreciate on the appropiate commands if any to try on this.

I am running good old version 1.19.5 ZM here.

Regards!

Posted: Thu May 11, 2006 1:17 am
by cordel
First check your mysql log and see why it is not starting. If the tables are corrupt you can try as outlined in this thread:
http://www.zoneminder.com/forums/viewtopic.php?t=5657
Otherwise we will need to know why mysql is not starting.

Regards,
Corey

Posted: Thu May 11, 2006 2:02 pm
by Eklectick
Cordel

Thanks for your reply. I tried to use de mysqlcheck and myisamcheck first but it was a no go, on the first error 2002 and the second one error 30, something about the files being read only.

On that thread gessel posts he used the "e2fsck" command which I did once remember using on a linux which went bad because of an improper shutdown. I used it on this drive but did not use any switch. Lots of errors started to pop up and since I did not use any switch, confirmation had to be executed on every error found.

I am not going to kid here, there were so many errors expecting a "Yes" from the keyboard that after 2 hours I left the "Y" key on the keyboard pressed with a battery and a remote control and went to sleep :lol:

I know this was not the most elegant fix, and perhaps a switch could have helped on this one, but what matters is that I did find light at the end of the tunnel and ZM went live again.

I think this hard disk is really living on borrowed time but "e2fsck" got it up at least to work with it and make a backup.

Regards!

Posted: Fri May 12, 2006 11:11 am
by zoneminder
I hope you didn't run e2fsck on a mounted filesystem :shock:

There is a handy switch '-y' you can pass to e2fsck to auto answer yes to every question. Handy to know for next time :lol: