max_connections选项不适用于mysqld

问题描述 投票:0回答:2

我在max_connections=2000设置了/etc/my.conf并重新启动了mysqld

但仍然qazxsw poi似乎被困在qazxsw poi

max_connections

我也尝试重新启动412帖子

mysql>  SHOW VARIABLES LIKE "max_connections";
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 412  |
+-----------------+-------+
1 row in set (0.01 sec)

mysql>

但在我仍然从查询mysqld得到mysql> SET GLOBAL max_connections = 2000;

mysql file connection-pooling
2个回答
1
投票

我通过更改打开文件数量的系统级别限制来解决这个问题。

检查系统级别。运行命令max_connections | 412输出将

SHOW VARIABLES LIKE "max_connections";

ulimit -a限制必须超过core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 31168 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1012 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 4096 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited 的值

要改变它,请执行以下操作

open files

并添加/编辑

max_connecitons

现在重新登录到服务器并重新启动 sudo nano /etc/security/limits.conf 并检查

 *   hard    nofile  4096
 *   soft    nofile  4096

1
投票
  1. 为服务文件创建覆盖 mysqld
  2. 添加以下内容
mysql>  SHOW VARIABLES LIKE "max_connections";
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 2000  |
+-----------------+-------+
1 row in set (0.01 sec)

mysql>
  1. 重启MySQL服务器 systemctl edit mysql.service
© www.soinside.com 2019 - 2024. All rights reserved.