ElectronicManuel Posted July 5, 2017 Share Posted July 5, 2017 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: emanuelsMain Domain: emanuels.heliohost.orgServer: johnny Kind regardsA desperate student trying to get his database working Quote Link to comment Share on other sites More sharing options...
Krydos Posted July 6, 2017 Share Posted July 6, 2017 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. Quote Link to comment Share on other sites More sharing options...
ElectronicManuel Posted July 6, 2017 Author Share Posted July 6, 2017 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 Quote Link to comment Share on other sites More sharing options...
Krydos Posted July 6, 2017 Share Posted July 6, 2017 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 problemClose all of those connections instead of leaving them sitting open for hours. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.