Unable to connect to ZM db

Previous development branch now released as 1.36
Locked
racelife
Posts: 84
Joined: Mon Mar 22, 2010 11:38 pm

Unable to connect to ZM db

Post by racelife »

When I go my server webpage this is what I get:
Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory

Not sure where to go from here...

I tried running zmupdate.pl as I had seen in another post but this is what I got:

WARNING: ZoneMinder configuration file found but is not readable. Check file permissions on /etc/zm/zm.conf
Use of uninitialized value $ZoneMinder::Config::Config{"ZM_DB_HOST"} in pattern match (m//) at /usr/share/perl5/ZoneMinder/Database.pm line 81.
Use of uninitialized value $ZoneMinder::Config::Config{"ZM_DB_HOST"} in concatenation (.) or string at /usr/share/perl5/ZoneMinder/Database.pm line 91.
Use of uninitialized value $ZoneMinder::Config::Config{"ZM_DB_NAME"} in concatenation (.) or string at /usr/share/perl5/ZoneMinder/Database.pm line 110.
DBI connect('database=;host=','',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
Use of uninitialized value $ZoneMinder::Config::Config{"ZM_DB_HOST"} in pattern match (m//) at /usr/share/perl5/ZoneMinder/Database.pm line 81.
Use of uninitialized value $ZoneMinder::Config::Config{"ZM_DB_HOST"} in concatenation (.) or string at /usr/share/perl5/ZoneMinder/Database.pm line 91.
Use of uninitialized value $ZoneMinder::Config::Config{"ZM_DB_NAME"} in concatenation (.) or string at /usr/share/perl5/ZoneMinder/Database.pm line 110.
DBI connect('database=;host=','',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
05/23/2020 15:33:07.209612 zmupdate[785].ERR [ZoneMinder::Database:113] [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) error val:]
05/23/2020 15:33:07.209935 zmupdate[785].ERR [ZoneMinder::Database:113] [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) error val:]
Use of uninitialized value $ZoneMinder::Config::Config{"ZM_DB_HOST"} in pattern match (m//) at /usr/share/perl5/ZoneMinder/Database.pm line 81.
Use of uninitialized value $ZoneMinder::Config::Config{"ZM_DB_HOST"} in concatenation (.) or string at /usr/share/perl5/ZoneMinder/Database.pm line 91.
Use of uninitialized value $ZoneMinder::Config::Config{"ZM_DB_NAME"} in concatenation (.) or string at /usr/share/perl5/ZoneMinder/Database.pm line 110.
DBI connect('database=;host=','',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
05/23/2020 15:33:07.210445 zmupdate[785].ERR [ZoneMinder::Database:113] [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) error val:]
Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 96.
BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.
Compilation failed in require at /usr/bin/zmupdate.pl line 73.
BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 73.
racelife
Posts: 84
Joined: Mon Mar 22, 2010 11:38 pm

Re: Unable to connect to ZM db

Post by racelife »

Sorry forgot to mention I'm on 1.35.4~20200515115321-bionic
rockedge
Posts: 1178
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Unable to connect to ZM db

Post by rockedge »

I think your problem is as simple as the wrong permissions are set for the ZM configuration directory /etc/zm!

insure that
/etc/zm
/var/cache/zoneminder
/var/log/zm

all are owned by the webserver and ZM user! In my case it is www-data most of the time

Code: Select all

chown -R www-data:www-data /etc/zm
racelife
Posts: 84
Joined: Mon Mar 22, 2010 11:38 pm

Re: Unable to connect to ZM db

Post by racelife »

I did sudo chown -R www-data:www-data /etc/zm and reboot but it didn't change anything.
rockedge
Posts: 1178
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA

Re: Unable to connect to ZM db

Post by rockedge »

is the mysql server running?
racelife
Posts: 84
Joined: Mon Mar 22, 2010 11:38 pm

Re: Unable to connect to ZM db

Post by racelife »

I'm not sure... what is the command to see and start if needed?
User avatar
bkjaya1952
Posts: 282
Joined: Sat Aug 25, 2018 3:24 pm
Location: Sri Lanka

Re: Unable to connect to ZM db

Post by bkjaya1952 »

racelife
Posts: 84
Joined: Mon Mar 22, 2010 11:38 pm

Re: Unable to connect to ZM db

Post by racelife »

bkjaya1952 wrote: Sun May 31, 2020 6:00 am Please try the procedure mentioned in this link below.

https://wiki.zoneminder.com/How_to_Inst ... cal_Fossa)




https://bkjaya.wordpress.com/2020/05/27 ... ker-image/
I'm not running 20.04 and this is not a new install. I'm not sure what procedure you are referring to. I'm on 18.04.4
Locked