mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 152 |
+-----------------+-------+
1 row in set (0.00 sec)
默认是152的连接数。修改方法如下:
1)临时性修改
mysql> set GLOBAL max_connections=1024;
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1024 |
+-----------------+-------+
1 row in set (0.00 sec)
2)永久性修改
在my.cnf文件中配置:
[mysqld] //新添加一行如下参数
max_connections=1000
重启mysql服务即可