MySQL says the user already has more than max_user_connections active connections
ERROR 1203 (42000): User app already has more than 'max_user_connections' active connectionsShort answer
Error 1203 means one account is at its own connection ceiling, not the server's. The ceiling is the account's MAX_USER_CONNECTIONS value, or the global max_user_connections variable when the account value is 0. Find the limit that applies, then raise it or close the connections your application leaves open.
Fix it fast
1Find out which cause you have
Read the two numbers that decide the limit: the global variable and the account's own value (0 means the global one applies), then list the live connections and count those of that account.
SHOW VARIABLES LIKE 'max_user_connections'; SELECT User, Host, max_user_connections FROM mysql.user WHERE User = 'app'; SHOW PROCESSLIST;2Match what you see, then jump to its fix
- 1
mysql.user shows a small non-zero max_user_connections for that accountThe account has a low MAX_USER_CONNECTIONS limitFix - 2
The account row shows 0 and SHOW VARIABLES gives a small number for max_user_connectionsThe account value is 0 and the global max_user_connections is smallFix - 3
The account is exactly at its limit and the error appears only now and then, right after a reconnectA disconnect and an immediate connect raceFix
- 1
What does the error look like?
ERROR 1203 (42000): User app already has more than 'max_user_connections' active connectionsER_TOO_MANY_USER_CONNECTIONS
Cause 1 of 3
The account has a low MAX_USER_CONNECTIONS limit
1Check
A non-zero account value is the cap for that account, whatever the global variable says.
SELECT User, Host, max_user_connections FROM mysql.user WHERE User = 'app';2Fix
Raise the account limit to what the application really needs, or set it to 0 so the global value applies.
ALTER USER 'app'@'%' WITH MAX_USER_CONNECTIONS 20;3Verify
Reconnect as that account and run the workload that failed.
SELECT User, Host, max_user_connections FROM mysql.user WHERE User = 'app';Confirmed by dev.mysql.com
Cause 2 of 3
The account value is 0 and the global max_user_connections is small
1Check
When an account value is 0, the global max_user_connections decides. If that is 0 too, there is no limit for the account.
SHOW VARIABLES LIKE 'max_user_connections';2Fix
Give the busy account its own explicit value. A non-zero account value replaces the global one for that account only, so other accounts keep their limit.
ALTER USER 'app'@'%' WITH MAX_USER_CONNECTIONS 50;3Verify
Read the account row back.
SELECT User, Host, max_user_connections FROM mysql.user WHERE User = 'app';Confirmed by dev.mysql.com
Cause 3 of 3
A disconnect and an immediate connect race
1Check
The manual describes an edge case: when an account has its maximum connections open, a disconnect followed quickly by a connect can fail if the server has not finished processing the disconnect.
SHOW PROCESSLIST;2Fix
Leave headroom. Set the account limit above the largest pool size your application runs, and add a short retry in the client for the connect call.
ALTER USER 'app'@'%' WITH MAX_USER_CONNECTIONS 25;3Verify
Restart the application several times and confirm the error no longer appears.
SHOW PROCESSLIST;Confirmed by dev.mysql.com
How do I stop it coming back?
- Set the pool size of each application below the account's limit, counting every instance.
- Give each application its own MySQL account, so a limit on one cannot starve another.
- Keep a record of which accounts carry a MAX_USER_CONNECTIONS value, so a limit is never a surprise.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- ShopGoAn e-commerce aggregator with a Python scraping engine behind its catalog, past 10K Google Play downloads.
Related fixes
Databases
MySQL 'Too many connections' when PHP opens database connections
Too many connections
Every connection slot up to max_connections is in use.
3 causes, each with a fixDatabases
Installing the Airflow MySQL provider fails on pkg-config or mysqlclient
Building the mysqlclient wheel fails during the install
The Airflow MySQL provider depends on mysqlclient, which pip compiles against the MySQL C client library.
2 causes, each with a fixDatabases
A query on Aurora MySQL dies with 'table /rdsdbdata/tmp/#sql... is full'
ERROR 1114 (HY000): The table '/rdsdbdata/tmp/#sqlfd_1586_2' is full
In Aurora MySQL 3, internal temporary tables share one pool, and when that pool and the memory-mapped overflow file are used up, a reader instance ends the query with error 1114.
3 causes, each with a fixDatabases
Azure Database for MySQL refuses a connection that does not use SSL
ERROR 3159 (HY000): Connections using insecure transport are prohibited while --require_secure_transport=ON.
Azure Database for MySQL Flexible Server requires encrypted connections by default (require_secure_transport = ON, TLS 1.2).
4 causes, each with a fixDatabases
Compiling a C or C++ program that includes mysql.h fails
undefined reference to `mysql_init'
The compiler only finds mysql.h when the MySQL client development files are installed and their folder is on the include path.
3 causes, each with a fixDatabases
DBeaver fails to resolve Maven dependencies when downloading a database driver
A driver library does not download automatically
DBeaver downloads driver jars from a Maven repository.
3 causes, each with a fix