dlandon / zoneminder.machine.learning

Zoneminder Docker
GNU General Public License v2.0
318 stars 143 forks source link

Unable to connect to ZM db.SQLSTATE[HY000] [2002] Connection refused #176

Closed buzzik closed 3 years ago

buzzik commented 3 years ago

This error appears after the last reboot (tonight)

Unable to connect to ZM db.SQLSTATE[HY000] [2002] Connection refused

I see this in log

zoneminder    |  * Starting Apache httpd web server apache2
zoneminder    |  *
zoneminder    |  * Starting MariaDB database server mysqld
zoneminder    |    ...fail!
zoneminder    | DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
zoneminder    | DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
zoneminder    | DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
zoneminder    | Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 96.
zoneminder    | BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.
zoneminder    | Compilation failed in require at /usr/bin/zmupdate.pl line 73.
zoneminder    | BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 73.
zoneminder    | Apr  1 18:26:23 0ee4e7f75768 zmupdate[1020]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) error val:]
zoneminder    | Apr  1 18:26:23 0ee4e7f75768 zmupdate[1020]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) error val:]
zoneminder    | DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
zoneminder    | DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
zoneminder    | DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
zoneminder    | Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 96.
zoneminder    | BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.
zoneminder    | Compilation failed in require at /usr/bin/zmupdate.pl line 73.
zoneminder    | BEGIN failed--compilation aborted at /usr/bin/zmupdate.pl line 73.
zoneminder    | Apr  1 18:26:23 0ee4e7f75768 zmupdate[1022]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) error val:]
zoneminder    | Apr  1 18:26:23 0ee4e7f75768 zmupdate[1022]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) error val:]
zoneminder    | Starting ZoneMinder:
zoneminder    | DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
zoneminder    | DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
zoneminder    | DBI connect('database=zm;host=localhost','zmuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) at /usr/share/perl5/ZoneMinder/Database.pm line 110.
zoneminder    | Can't call method "prepare_cached" on an undefined value at /usr/share/perl5/ZoneMinder/Config.pm line 96.
zoneminder    | BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder/Config.pm line 147.
zoneminder    | Compilation failed in require at /usr/share/perl5/ZoneMinder.pm line 33.
zoneminder    | BEGIN failed--compilation aborted at /usr/share/perl5/ZoneMinder.pm line 33.
zoneminder    | Compilation failed in require at /usr/bin/zmpkg.pl line 34.
zoneminder    | BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 34.
zoneminder    | Apr  1 18:26:24 0ee4e7f75768 zmpkg[1032]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) error val:]
zoneminder    | Apr  1 18:26:24 0ee4e7f75768 zmpkg[1032]: ERR [Error reconnecting to db: errstr:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (111) error val:]
zoneminder    | ZoneMinder failed to start
zoneminder    |
zoneminder    | *** /etc/my_init.d/40_firstrun.sh failed with status 255
zoneminder    |
zoneminder    | *** Killing all processes...
zoneminder    | Apr  1 18:26:24 0ee4e7f75768 syslog-ng[21]: syslog-ng shutting down; version='3.25.1'
zoneminder exited with code 1

Mysql log:

2021-04-01 20:10:39 3 [ERROR] InnoDB: Your database may be corrupt or you may have copied the InnoDB tablespace but not the InnoDB log files. Please refer to htt                                               ps://mariadb.com/kb/en/library/innodb-recovery-modes/ for information about forcing recovery.

What should I do ?

dlandon commented 3 years ago

Try getting some help at the ZM forum. This is probably a database issue - corruption?

meichthys commented 3 years ago

@buzzik Were you able to figure out what might be corrupting your database? I've been running into this same issue every time I setup zoneminder on a docker host running as a VM in proxmox.

My suspicion is that when the docker VM is put into a saved state in order to run a backup, the database is somehow corrupted at that point.

sam-mancarella commented 3 years ago

I’ve experienced similar issues with my installation. I found that it becomes an issue once my database contains more than a couple hundred events.

On 26 Aug 2021, at 11:36 am, MeIchthys @.***> wrote:

 @buzzik Were you able to figure out what might be corrupting your database? I've been running into this same issue every time I setup zoneminder on a docker host running as a VM in proxmox.

My suspicion is that when the docker VM is put into a saved state in order to run a backup, the database is somehow corrupted at that point.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.