咨询热线:4006-75-4006
售前:9:00-23:30 备案:9:00-18:00 技术:7*24h
设置mysql 5.6最大连接数的方法
mysql5.6连接数默认是151
mysql> select version();
+------------+
| version() |
+------------+
| 5.6.25-log |
+------------+
1 row in set (0.00 sec)
mysql> show variables like '%max_connection%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 151 |
+-----------------+-------+
1 row in set (0.00 sec)
mysql>
可以修改临时生效:
mysql> set GLOBAL max_connections=500;
临时修改为500,重启后失效
mysql> set GLOBAL max_connections=500;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like '%max_connection%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 500 |
+-----------------+-------+
1 row in set (0.00 sec)
mysql>
可以通过修改mysql配置文件,永久生效
修改/etc/my.cnf(如果是二进制安装,修改对应的my.cnf文件)
max_connections=1500
重启,永久生效
显示当前运行的Query:mysql> show processlist
显示当前状态:mysql> show status