Unable to connect to ZM db

Forum for questions and support relating to 1.35.x development only.
Post Reply
racelife
Posts: 82
Joined: Mon Mar 22, 2010 11:38 pm

Unable to connect to ZM db

Post by racelife » Sat May 23, 2020 9:49 pm

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: 82
Joined: Mon Mar 22, 2010 11:38 pm

Re: Unable to connect to ZM db

Post by racelife » Sun May 24, 2020 9:26 pm

Sorry forgot to mention I'm on 1.35.4~20200515115321-bionic

rockedge
Posts: 1146
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: Unable to connect to ZM db

Post by rockedge » Mon May 25, 2020 4:55 pm

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: 82
Joined: Mon Mar 22, 2010 11:38 pm

Re: Unable to connect to ZM db

Post by racelife » Wed May 27, 2020 11:27 pm

I did sudo chown -R www-data:www-data /etc/zm and reboot but it didn't change anything.

rockedge
Posts: 1146
Joined: Fri Apr 04, 2014 1:46 pm
Location: Connecticut,USA
Contact:

Re: Unable to connect to ZM db

Post by rockedge » Thu May 28, 2020 1:38 am

is the mysql server running?

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

Re: Unable to connect to ZM db

Post by racelife » Thu May 28, 2020 2:01 am

I'm not sure... what is the command to see and start if needed?

User avatar
bkjaya1952
Posts: 34
Joined: Sat Aug 25, 2018 3:24 pm
Location: Sri Lanka
Contact:

Re: Unable to connect to ZM db

Post by bkjaya1952 » Sun May 31, 2020 6:00 am


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

Re: Unable to connect to ZM db

Post by racelife » Wed Jun 03, 2020 12:41 am

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

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest