> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/error-codes/mariadb-error-codes-1200-to-1299/e1226.md).

# 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](/docs/server/reference/sql-statements/account-management-sql-statements/create-user.md#resource-limit-options), 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:

```sql
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](/docs/server/server-management/variables-and-modes/server-system-variables.md#max_user_connections) system variable. An account without its own limit that reaches the global one gets [error 1203](/docs/server/reference/error-codes/mariadb-error-codes-1200-to-1299/e1203.md) 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](/docs/server/reference/sql-statements/administrative-sql-statements/flush-commands/flush.md).
* 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.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}
