Jump to content

Mysql Max_User_Connections


Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...