Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
I have been using zoneminder for about a week.
My system Ubuntu Server 20.04 LTS
The server was shut down due to an intermediate electrical problem, and when I turned it on again, I was unable to connect the zoneminder.
When I try to go to http: // hostip / zm I get the following error:
Error Code on Web page: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
can you help me ? please..
My system Ubuntu Server 20.04 LTS
The server was shut down due to an intermediate electrical problem, and when I turned it on again, I was unable to connect the zoneminder.
When I try to go to http: // hostip / zm I get the following error:
Error Code on Web page: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
can you help me ? please..
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
check into your mysql state.
systemctl status mysql
systemctl start mysql
if it won't start check error logs in /var/log/mysql/error.log
systemctl status mysql
systemctl start mysql
if it won't start check error logs in /var/log/mysql/error.log
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
I checked. There is such a log.
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: deactivating (stop-sigterm) (Result: timeout)
Process: 2247 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 2258 (mysqld)
Status: "Server startup in progress"
Tasks: 20 (limit: 38372)
Memory: 323.1M
CGroup: /system.slice/mysql.service
└─2258 /usr/sbin/mysqld
Jun 17 17:37:40 shewarobitnvr systemd[1]: Starting MySQL Community Server...
Jun 17 17:47:40 shewarobitnvr systemd[1]: mysql.service: start operation timed out. Terminating.
LOG:
2020-06-16T21:24:46.720179Z 48541 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will b>
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: deactivating (stop-sigterm) (Result: timeout)
Process: 2247 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 2258 (mysqld)
Status: "Server startup in progress"
Tasks: 20 (limit: 38372)
Memory: 323.1M
CGroup: /system.slice/mysql.service
└─2258 /usr/sbin/mysqld
Jun 17 17:37:40 shewarobitnvr systemd[1]: Starting MySQL Community Server...
Jun 17 17:47:40 shewarobitnvr systemd[1]: mysql.service: start operation timed out. Terminating.
LOG:
2020-06-16T21:24:46.720179Z 48541 [Warning] [MY-013360] [Server] Plugin sha256_password reported: ''sha256_password' is deprecated and will b>
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
I've had this a few times lately and the cause seems to be disk space.
Can you run?
Can you run
Code: Select all
df -h
-
- Posts: 3
- Joined: Sat Jul 11, 2020 9:19 am
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
I'm getting this error too, I'm using zoneminder docker - https://github.com/dlandon/zoneminder - which I've just discovered is now depreciated. I think the error relates to mysql server not running correctly.
- bkjaya1952
- Posts: 282
- Joined: Sat Aug 25, 2018 3:24 pm
- Location: Sri Lanka
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
Please try the followingKiwijunglist wrote: ↑Sun Jan 10, 2021 5:05 am I'm getting this error too, I'm using zoneminder docker - https://github.com/dlandon/zoneminder - which I've just discovered is now depreciated. I think the error relates to mysql server not running correctly.
https://hub.docker.com/r/bkjaya1952/zon ... ker-latest
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
I'm running ZM in a container on Proxmox, but was having the exact same issue. I couldn't get the DB to work even after a reboot. Disk space was fine too. I ended up going into mysql error logs where I found this
2021-01-11 1:38:05 0 [ERROR] Bad magic header in tc log
2021-01-11 1:38:05 0 [ERROR] Crash recovery failed. Either correct the problem (if it's, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2021-01-11 1:38:05 0 [ERROR] Can't init tc log
2021-01-11 1:38:05 0 [ERROR] Aborting
Upon doing some research into the tc log problem, I came upon this discussion:https://dba.stackexchange.com/questions ... nit-tc-log
The gist of it is to delete or mv the tc log. As soon as I did that, ZM came back to life. Now I just need to figure out why the tc log is causing this problem.
Hope this helps someone
2021-01-11 1:38:05 0 [ERROR] Bad magic header in tc log
2021-01-11 1:38:05 0 [ERROR] Crash recovery failed. Either correct the problem (if it's, for example, out of memory error) and restart, or delete tc log and start mysqld with --tc-heuristic-recover={commit|rollback}
2021-01-11 1:38:05 0 [ERROR] Can't init tc log
2021-01-11 1:38:05 0 [ERROR] Aborting
Upon doing some research into the tc log problem, I came upon this discussion:https://dba.stackexchange.com/questions ... nit-tc-log
The gist of it is to delete or mv the tc log. As soon as I did that, ZM came back to life. Now I just need to figure out why the tc log is causing this problem.
Hope this helps someone
-
- Posts: 64
- Joined: Tue Apr 27, 2021 3:41 am
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
@poohbah
thank you for posting your solution. It does bring zm back up. were you able to find out what's causing it?
thank you for posting your solution. It does bring zm back up. were you able to find out what's causing it?
- bkjaya1952
- Posts: 282
- Joined: Sat Aug 25, 2018 3:24 pm
- Location: Sri Lanka
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
Please drop mysql zm data base and re create as follows
mysql -e "drop database zm;"
mysql -uroot --password=""< /usr/share/zoneminder/db/zm_create.sql 2>/dev/null
mysql -e "ALTER USER 'zmuser'@localhost IDENTIFIED BY 'zmpass';"
mysql -e "GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;"
mysql -e "FLUSH PRIVILEGES ;"
mysql -e "drop database zm;"
mysql -uroot --password=""< /usr/share/zoneminder/db/zm_create.sql 2>/dev/null
mysql -e "ALTER USER 'zmuser'@localhost IDENTIFIED BY 'zmpass';"
mysql -e "GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;"
mysql -e "FLUSH PRIVILEGES ;"
-
- Posts: 64
- Joined: Tue Apr 27, 2021 3:41 am
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
@bkjaya1952
Thank you.
Thank you.
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
I had this problem and solved it with
sudo systemctl stop mysql
sudo systemctl start mysql
sudo systemctl stop mysql
sudo systemctl start mysql
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
Stopping and re-starting the DB server is not a solution, solving the problem of why it happens is and I don't see that here.
I'm running a brand new install of 1.34.26 on a Ubuntu 20.04 LTS server and initially, all seemed to be working fine then suddenly, db access loss.
I didn't see any reason for it in the logs and eventually rebooted but now this leaves me knowing there is a problem that will reoccur, making it impossible to put this device anywhere remote until solved.
I'll have to dig deeper when it happens again.
I'm running a brand new install of 1.34.26 on a Ubuntu 20.04 LTS server and initially, all seemed to be working fine then suddenly, db access loss.
I didn't see any reason for it in the logs and eventually rebooted but now this leaves me knowing there is a problem that will reoccur, making it impossible to put this device anywhere remote until solved.
I'll have to dig deeper when it happens again.
-
- Posts: 9
- Joined: Thu Oct 22, 2020 3:32 pm
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
I there any update on this?
I've reinstalled zoneminder so many times this month already due to MySQL failing
I've tried all the few suggestions I've been able to find online with no luck
Even the edited version of the installation guide mentions at the top to add some lines in a file, but they listed an incorrect section [mysqld] when mine only has [mysql]
I tried adding the extra lines under [mysql] and [mariadb] only to have the DB fail to even start
I notice when people are asking for help, the person who creates these guides give MINIMAL help and is very VAGUE
I've reinstalled zoneminder so many times this month already due to MySQL failing
I've tried all the few suggestions I've been able to find online with no luck
Even the edited version of the installation guide mentions at the top to add some lines in a file, but they listed an incorrect section [mysqld] when mine only has [mysql]
I tried adding the extra lines under [mysql] and [mariadb] only to have the DB fail to even start
I notice when people are asking for help, the person who creates these guides give MINIMAL help and is very VAGUE
-
- Posts: 9
- Joined: Thu Oct 22, 2020 3:32 pm
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
by the time i tried this, i was locked out of the database due to ZM failingbkjaya1952 wrote: ↑Tue Apr 27, 2021 6:38 am Please drop mysql zm data base and re create as follows
mysql -e "drop database zm;"
mysql -uroot --password=""< /usr/share/zoneminder/db/zm_create.sql 2>/dev/null
mysql -e "ALTER USER 'zmuser'@localhost IDENTIFIED BY 'zmpass';"
mysql -e "GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;"
mysql -e "FLUSH PRIVILEGES ;"
got this error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
-
- Posts: 1336
- Joined: Sat Aug 31, 2019 7:35 am
- Location: San Diego
Re: Unable to connect to ZM db.SQLSTATE[HY000] [2002] No such file or directory
Which guide was that, exactly? Using the correct one should work, especially "the easy way" ones.Even the edited version of the installation guide mentions at the top to add some lines in a file, but they listed an incorrect section [mysqld] when mine only has [mysql]