Page 1 of 1

Suse 10.3, ZM 1.23.1 Can't connect to local MySQL server

Posted: Sun Feb 17, 2008 4:54 pm
by keynet

I've been struggling with this mysql error for a day or so, and tried searching the forums, but am now stuck.
I've tried both the rpm for Suse 10.3 and building from source with the pre-requisites. Both behave the same.

I get

Code: Select all

Feb 17 16:15:07 ha-server zmfix[17676]: ERR [Can't connect to server: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)]
Feb 17 16:15:07 ha-server zmpkg[17666]: ERR [Unable to run "sudo -u wwwrun /usr/local/bin/zmfix", output is ""] 
zmpkg.log is

Code: Select all

02/17/08 16:15:07.452446 zmpkg[17666].INF [Command: start]
02/17/08 16:15:07.452953 zmpkg[17666].DBG [Testing valid shell syntax]
02/17/08 16:15:07.453061 zmpkg[17666].DBG [Testing "sudo -u wwwrun true"]
02/17/08 16:15:07.461883 zmpkg[17666].DBG [Test ok, using format "sudo -u wwwrun <command>"]
02/17/08 16:15:07.462011 zmpkg[17666].DBG [Command: sudo -u wwwrun /usr/local/bin/ check]
02/17/08 16:15:07.608870 zmpkg[17666].DBG [Output: stopped]
02/17/08 16:15:07.608993 zmpkg[17666].DBG [Removing shared memory]
02/17/08 16:15:07.609053 zmpkg[17666].DBG [Checking for shared memory with 'ipcs -m | grep '^0x7a6d00'']
02/17/08 16:15:07.613977 zmpkg[17666].DBG [Command: sudo -u wwwrun /usr/local/bin/zmfix]
02/17/08 16:15:07.623394 zmpkg[17666].ERR [Unable to run "sudo -u wwwrun /usr/local/bin/zmfix", output is ""]
I have checked that mysql is running and used mysqladmin to checkout the basics - that looks OK, it's running.

So I tried editing my.cnf to change the socket location to /tmp/mysql.sock, restarted mysql (the socket location changes as expected), but now zmpkg gives the following error:

Code: Select all

DBI connect('database=zm;host=localhost','zm_admin',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /usr/lib/perl5/site_perl/5.8.8/ZoneMinder/ line 89
Can't call method "prepare_cached" on an undefined value at /usr/lib/perl5/site_perl/5.8.8/ZoneMinder/ line 91.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/ZoneMinder/ line 100.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/ line 33.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/ line 33.
Compilation failed in require at /usr/local/bin/ line 45.
BEGIN failed--compilation aborted at /usr/local/bin/ line 45.
It appears like different parts of the program are hardwired to look in different places for the socket, and both can't be right at the same time.
Can I change where zmfix is looking for the socket - can't see anything obvious in the source.
But maybe it's some kind of simple permissions problem instead?

Help much appreciated

Posted: Mon Feb 18, 2008 10:50 pm
by zoneminder
They can sometimes be configured to be in different places. This is a mysql and perl issue rather than ZM. Off the top of my head I can't remember where this config is set so the easiest thing I normally recommend is just creating a soft link from one to the other.


Code: Select all

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
for example, though do it whichever way round so that the one that exists is first. That way whenever one is created so will the other be.

Posted: Thu Feb 21, 2008 12:29 am
by keynet
Thanks - yes that's got it going