Jump to content

Recommended Posts

Posted

I have a mysql db with two separate users. But whenever I try to connect to it via mysql workbench or my application it shows the max_user_connections error.

I checked the connections with 'show processlist' and it showed 2 new connections each time I fired the query so I assumed the two were used to query the connections.

I also added the wildcard host '%' as allowed remote host since my application is a swing application and I don't know my teachers ip address.

 

I am really running out of ideas here, if there is no other way to solve this problem I would appreciate you increasing my maximum connections

 

cPanel Username: emanuels

Main Domain: emanuels.heliohost.org

Server: johnny

 

Kind regards

A desperate student trying to get his database working

Posted

The main reason people see that error is because they don't close their mysql connections. I've never used mysql workbench, but when I connect to mysql through to command line

mysql --host=johnny.heliohost.rg --user=krydos --database=krydos_db -p
that is going to use up one of the available mysql connections until I type exit which closes the connection. I suspect mysql workbench is the same.

 

As far as your application, most languages keep mysql connections open in case you need them again until you explicitly close them, or the script ends. The syntax to close the connection depends on the language you use. Well written code will open a mysql connection execute the query and immediately close the connection again. That way the mysql connection is only open for a few milliseconds. The longer you leave those connections open the more likely you are to see that error.

Posted

Yeah, I get that, but wouldnt show processlist show any persisting connections?

 

Now after I restarted my computer it worked for a while, and then the error showed up again.

I added another user and added it to the db and the error showed up on the first connection with that user (!)

 

I hope there might be a fix for this problem

Posted

You've got a bunch of mysql connections that have been sleeping without sending or receiving a single byte of information for about 2 hours.

 

I hope there might be a fix for this problem

Close all of those connections instead of leaving them sitting open for hours.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...