修改MYSQL最大连接数的3种方法详解 收藏
方法一:进入MYSQL安装目录 打开MYSQL配置文件 my.ini 或 my.cnf查找 max_connections=100
修改为 max_connections=1000 服务里重起MYSQL即可
方法二:MySQL的最大连接数默认是100客户端登录:mysql -uusername -ppassword
设置新的最大连接数为200:mysql> set GLOBAL
max_connections=200
显示当前运行的Query:mysql> show processlist
显示当前状态:mysql> show status
退出客户端:mysql> exit
查看当前最大连接数:mysqladmin -uusername -ppassword variables
The number of connections allowed is controlled by the
max_connections system variable. Its default value is 100. If you
need to support more connections, you should restart mysqld with a
larger value for this variable.
The maximum number of connections MySQL can support depends on the
quality of the thread library on a given platform. Linux or Solaris
should be able to support 500-1000 simultaneous connections,
depending on how much RAM you have and what your clients are doing.
Static Linux binaries provided by MySQL AB can support up to 4000
connections.
实际MySQL服务器允许的最大连接数16384(2^14)
1000人同时在线,请问mysql 最大连接数设置多少才合理!谢谢!
不要太大,如果设置连接数1000,你这个CPU不够,要爆了
最好是加大内存,一般mysql连接数设置300就好了,基本上是占用300M左右的内存