修改/etc/mysql/mysql.conf.d/mysqld.cnf,設定需要的連線數:
max_connections=1000
再修改/lib/systemd/system/mysql.service,增加以下設定值:
LimitNOFILE=8192
接著執行以下指令:
systemctl daemon-reload
systemctl restart mysql.service
驗證:
進mysql後執行
show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+
1 row in set (0.01 sec)