For the complete documentation index, see llms.txt. This page is also available as Markdown.

Error 1226: User has exceeded the resource

Error Code
SQLSTATE
Error
Description

1226

42000

ER_USER_LIMIT_REACHED

User '%s' has exceeded the '%s' resource (current value: %ld)

Possible Causes and Solutions

The account has reached one of its own resource limits, set with CREATE USER, ALTER USER, or GRANT. The message names the limit and its value:

Resource in the message
Limit
When the error occurs

max_user_connections

MAX_USER_CONNECTIONS

When connecting, if the account already has that many sessions open.

max_connections_per_hour

MAX_CONNECTIONS_PER_HOUR

When connecting, after that many connections in the current hour.

max_queries_per_hour

MAX_QUERIES_PER_HOUR

On a statement, after that many statements in the current hour.

max_updates_per_hour

MAX_UPDATES_PER_HOUR

On a statement that changes data, after that many such statements in the current hour.

For example:

CREATE USER 'app'@'localhost' IDENTIFIED BY '…' WITH MAX_USER_CONNECTIONS 1;

A second session of app then fails:

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

The account's own MAX_USER_CONNECTIONS limit replaces the global max_user_connections system variable. An account without its own limit that reaches the global one gets error 1203 instead.

To solve the error:

  • For max_user_connections, close sessions that the account no longer uses.

  • For the per-hour limits, wait until the hour is over, or reset the counters of all accounts with FLUSH USER_RESOURCES.

  • Raise the limit with ALTER USER, for example ALTER USER 'app'@'localhost' WITH MAX_QUERIES_PER_HOUR 10000;. A value of 0 means no limit.

This page is licensed: CC BY-SA / Gnu FDL

spinner

Last updated

Was this helpful?