问题描述:
mysql数据库运行异常,登录报错,Too many connections
原因:
mysql数据库默认的连接数太小
处理方法:
修改mysql数据库的配置文件 my.conf
修改字段,配置文件没有就在 [msyqld] 字段下添加
max_connections=512 修改为 max_connections=20000
重启数据库
systemctl restart mysql
登录成功:
mysql -uroot -p
查看数据库连接命令
1、查看当前连接数:
show global status like'Max_used_connections';
2、查看最大支持连接数:
select VARIABLE_VALUE from information_schema.GLOBAL_VARIABLES where VARIABLE_NAME='MAX_CONNECTIONS';
3、修改最大连接数:
set global max_connections = 3600;