Unable to connect to ZM db.SQLSTATE[08004] [1040] Too many connections

Forum for questions and support relating to the 1.30.x releases only.
Post Reply
doubleosix
Posts: 20
Joined: Fri Jul 13, 2018 1:45 am

Unable to connect to ZM db.SQLSTATE[08004] [1040] Too many connections

Post by doubleosix » Fri Jul 13, 2018 2:04 am

Hi,

After changing the function of my 36 cameras to "modect" zoneminder's state suddenly changed from running to stopped, I restarted zoneminder and refreshed the ZM-Console webpage and got the following error " Unable to connect to ZM db.SQLSTATE[08004] [1040] Too many connections ".

When I restarted Zonminder with "sudo systemctl restart zoneminder" and I got the following error "Can't connect to database: Access denied for user 'apache@localhost' (using password:YES)"

Can anyone please help me sort this out?

Thanks.

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

Re: Unable to connect to ZM db.SQLSTATE[08004] [1040] Too many connections

Post by rockedge » Fri Jul 13, 2018 8:23 pm

mysql server is running? have you restarted the mysql? see if ZM can connect? has anything happen to the /etc/zm/zm.conf file?

does ZM start with 36 cams in "monitor" mode? can you select 1 or 2 cams for modect and does that work?

doubleosix
Posts: 20
Joined: Fri Jul 13, 2018 1:45 am

Re: Unable to connect to ZM db.SQLSTATE[08004] [1040] Too many connections

Post by doubleosix » Sat Jul 14, 2018 1:08 am

zm.conf is present, I opened it with VI and read it, I don't see anything obviously wrong with it.

I was able to get zoneminder running again by changing 13 of my cameras to monitor instead of motion detect. I still need to know what I need to do so that I can use motion detection on all of the cameras.

I saw some posts from older versions of zoneminder where people had run into the "too many connections error" but the configuration files for mysql / mariadb don't seem to be in the places indicated in those posts. Can anyone tell me how to increase the number of connections to the mysql database so that I can record on all 36 cameras?

bbunge
Posts: 2442
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Unable to connect to ZM db.SQLSTATE[08004] [1040] Too many connections

Post by bbunge » Sat Jul 14, 2018 1:41 am

Linux distro and version? MYSQL or Mariadb?

You can add the setting to the /etc/my.cnf
[mysqld]
max_connections=1000

Restart mysql or mariadb

Run mysqltuner every few days to see where you need to make changes.

doubleosix
Posts: 20
Joined: Fri Jul 13, 2018 1:45 am

Re: Unable to connect to ZM db.SQLSTATE[08004] [1040] Too many connections

Post by doubleosix » Sat Jul 14, 2018 2:20 am

CentOS 7 and Mariadb 5.5.56.

I do not have a file located at /etc/my.cnf. I do have a /etc/my.con.d folder but I dont think that is the right thing. I'm assuming there is no my.cnf because I have mariadb? or do I need to create a my.cnf file?

bbunge
Posts: 2442
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: Unable to connect to ZM db.SQLSTATE[08004] [1040] Too many connections

Post by bbunge » Sat Jul 14, 2018 6:34 pm

Wherever the config file for mariadb is add the max connections line.

doubleosix
Posts: 20
Joined: Fri Jul 13, 2018 1:45 am

Re: Unable to connect to ZM db.SQLSTATE[08004] [1040] Too many connections

Post by doubleosix » Sun Jul 15, 2018 7:42 am

I ended up just creating a configuration file at /etc/my.cnf. I set the max connections in the my.cnf to 2000, but when I check the max connections in mysql it shows 1190, what do I need to do to get the connections to actually reflect the settings in the my.cnf file?


Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests