2022-06-15 626
linux怎么修改mysql的最大连接数
客户端登录:
mysql -uroot -p
设置新的最大连接数为1000:
mysql> set GLOBAL max_connections=1000
显示当前运行的Query:
mysql> show processlist
显示当前状态:
mysql> show status
退出客户端:
mysql> exit
查看当前最大连接数:
mysqladmin -uroot -p variables
这个办法治标不治本,重启服务以后最大连接数还是100。这个方法用于紧急扩充最大连接数用,不是长久之计。
查看配置文件位置
/usr/bin/mysql --verbose --help | grep -A 1 'Default optio Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
服务器首先会读取/etc/my.cnf文件,如果不存在则读取/etc/mysql/my.cnf,再依次读取/usr/etc/my.cnf 、~/.my.cnf
在根路径下查找配置文件:
find / -name my.cnf
结果:/etc/my.cnf
配置
vim /etc/my.cnf
编辑my.cnf在[mysqld]中加入:
max_connections=1000
重启服务
service mysqld restart
查看连接数
mysql -u root -p show variables like 'max_connections';
原文链接:https://77isp.com/post/1261.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态