max_connections 是指MySQL服务器的最大连接数。即所有用户最大连接数的和。
max_user_connections 是指MySQL中单个用户的最大连接数。
这里说明当前用户的连接数大于了单个用户的最大连接数,需要扩大连接数:

mysql> show variables like '%connect%';
+-----------------------------------------------+-----------------+
| Variable_name | Value |
+-----------------------------------------------+-----------------+
| character_set_connection | utf8mb3 |
| collation_connection | utf8_general_ci |
| connect_timeout | 10 |
| disconnect_on_expired_password | ON |
| init_connect | |
| max_connect_errors | 100 |
| max_connections | 4000 |
| max_user_connections | 1500 |
| mysqlx_connect_timeout | 30 |
| mysqlx_max_connections | 100 |
| performance_schema_session_connect_attrs_size | 512 |
+-----------------------------------------------+-----------------+
11 rows in set (0.00 sec)

mysql> set global max_user_connections=4000;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like '%connect%';
+-----------------------------------------------+-----------------+
| Variable_name | Value |
+-----------------------------------------------+-----------------+
| character_set_connection | utf8mb3 |
| collation_connection | utf8_general_ci |
| connect_timeout | 10 |
| disconnect_on_expired_password | ON |
| init_connect | |
| max_connect_errors | 100 |
| max_connections | 4000 |
| max_user_connections | 4000 |
| mysqlx_connect_timeout | 30 |
| mysqlx_max_connections | 100 |
| performance_schema_session_connect_attrs_size | 512 |
+-----------------------------------------------+-----------------+
11 rows in set (0.00 sec)