Forums

ERROR 1226 (42000): User '' has exceeded the 'max_user_connections' resource (current value: 6)

hello!

I'm having trouble setting up the mysql database. when I try to access the console on the Database tab I get the following error:

ERROR 1226 (42000): User 'Yahiba' has exceeded the 'max_user_connections' resource (current value: 6)

how can I solve this?

You need to close those connections. Check what other of your processes are keeping db connections open.

I didn't realize this was the problem. Thank you

I am having trouble to connect to the database, I tried to ping the host but I only get time outs, is this normal?

I tried through the Django projects and through dbeaver, the credentials seem to be correct.

actually I managed to run the project in the server, the problem was related to the previous issue.

However in localhst I can't do it. is there a specific combination to run the project in localhost maintaining the production database configuration?

Thanks

see the manual ssh tunnelling part of our help page.

Hi, I'm facing similar issue, how to identify these connections and close them? i've closed all of my consoles but with no result

It could be your web app or your task or your notebook.

I'm facing the same problem. How can i detect current active connection? Thank you.

If you have a MySQL console open, then the "SHOW PROCESSLIST" command can help you track down what is using what. If that isn't possible, you'll need to get in touch with us.

I am having the same error. I have configured one mysql database for users login and then one mysql database for each client and have 6 max user connections. That means that if more than five clients try to connect to their different databases in the same 5 minute period it will throw an error?

If you do not close the connection to the database as soon as you're finished with it, then you will quickly run out of connections.

I thought FLASK-SQLalchemy did that. I executed the SHOW PROCESSLIST; and saw that connection are maintained for about 300 seconds. Can that be changed?

It does not. It uses a connection pool and keeps the connections open and in the pool. You may be able to use the SQLALCHEMY_POOL_RECYCLE configuration key to close connections earlier, but whether it works will depend on how it's implemented in flask-sqlalchemy.

The connection timeout cannot be changed.

Thanks for the info. Considering this, with my actual schema in which each user has it own database my only solution would be to add workers if more users are added to avoid connection problems. One last question, if I handle some of the small or not frequently used databases with Sqlite instead mysql that would reduce the use of connections, but that could be a problem with the use of workers?

You could do that, yes -- the concern I would have with SQLite is performance with larger databases (which doesn't sound like it would be an issue for your case) or file locking causing problems with concurrent accesses. If one worker process is accessing a SQLite DB, it can acquire a lock which will make any other workers that are trying to access it wait until the first one is done before they can do anything. If these SQLite DBs are per-user, though, perhaps that wouldn't happen very often?