1226
MySQLERRORCommonConnectionHIGH confidence

User exceeded max_user_connections resource limit

Production Risk

Medium — application connections are refused; requires privilege change.

What this means

ER_USER_LIMIT_REACHED (1226, SQLSTATE 42000) is raised when a user account exceeds a resource limit set via GRANT, such as MAX_USER_CONNECTIONS, MAX_QUERIES_PER_HOUR, or MAX_UPDATES_PER_HOUR.

Why it happens
  1. 1Account has MAX_USER_CONNECTIONS set and the limit is reached
  2. 2Account has MAX_QUERIES_PER_HOUR or MAX_UPDATES_PER_HOUR exceeded
How to reproduce
trigger — this will error
trigger — this will error
-- User granted with resource limits
GRANT USAGE ON *.* TO 'app_user'@'%' WITH MAX_USER_CONNECTIONS 5;
-- Sixth connection attempt fails with 1226

expected output

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

Fix

Increase resource limits for the user

Increase resource limits for the user
ALTER USER 'app_user'@'%' WITH
  MAX_USER_CONNECTIONS 20
  MAX_QUERIES_PER_HOUR 0
  MAX_UPDATES_PER_HOUR 0;

Why this works

Setting limits to 0 means no limit. Increase MAX_USER_CONNECTIONS as needed.

Sources
Official documentation ↗

MySQL 8.0 — 1226 ER_USER_LIMIT_REACHED

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors