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

Support and queries relating to all previous versions of ZoneMinder
Posts: 127
Joined: Sat Nov 20, 2004 1:12 am

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

Postby Eklectick » Wed May 10, 2006 8:32 pm


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/ line 49
Can't call method "prepare_cached" on an undefined value at /usr/local/bin/ line 52.
BEGIN failed--compilation aborted at /usr/local/bin/ 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.


User avatar
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Postby cordel » Thu May 11, 2006 1:17 am

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:
Otherwise we will need to know why mysql is not starting.


Posts: 127
Joined: Sat Nov 20, 2004 1:12 am

Postby Eklectick » Thu May 11, 2006 2:02 pm


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.


User avatar
Site Admin
Posts: 5220
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK

Postby zoneminder » Fri May 12, 2006 11:11 am

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:

Return to “ZoneMinder Previous Versions”

Who is online

Users browsing this forum: No registered users and 0 guests