How i can change the variable max_connection to a higher value than 214. I try this on my.cnf but doesn't work
我如何将变量max_connection更改为高于214的值。我在my.cnf上尝试这个但是不起作用
max_connections = 2000
The version of MySql is 5.6.24 and i already restarted the server.
MySql的版本是5.6.24,我已经重新启动了服务器。
2 个解决方案
#1
You should also configure the open_files_limit and the table_open_cache , but be careful with open_files_limit_value not exceed the OS maximum.
您还应该配置open_files_limit和table_open_cache,但要小心open_files_limit_value不要超过OS最大值。
- Get mysql PID
- list the max open file for my sql using
获取mysql PID
列出我的sql使用的最大打开文件
cat /proc/ PID /limits | grep "open files"
cat / proc / PID / limits | grep“打开文件”
-
In /etc/my.cnf configure the following
在/etc/my.cnf中配置以下内容
open_files_limit= 4096 #the maximum of the OS
open_files_limit = 4096#操作系统的最大值
max_connections = 500
max_connections = 500
table_open_cache = 600
table_open_cache = 600
restart mysql server using
使用重启mysql服务器
service mysql restart
service mysql restart
#2
You can increase this value in main config file (e.g., /etc/my.cnf) using this syntax:
您可以使用以下语法在主配置文件(例如/etc/my.cnf)中增加此值:
[mysqld]
set-variable=max_connections=250
If it not work then either execute SET GLOBAL max_connections = 250;
in MySQL and restart MySQL.
如果它不起作用则执行SET GLOBAL max_connections = 250;在MySQL中重启MySQL。
NOTE:
You can find this error if your scripts open persistent connections, wich aren't closed even if the script terminates. Use mysql_connect() instead of mysql_pconnect() unless you have a good reason. In particular, check this setting in third-party scripts (such as osCommerce).
如果脚本打开持久连接,即使脚本终止也未关闭,您可以找到此错误。除非有充分的理由,否则请使用mysql_connect()而不是mysql_pconnect()。特别是,请在第三方脚本(例如osCommerce)中检查此设置。
Server administrators can disable persistent connections for PHP scripts in php.ini file:
服务器管理员可以在php.ini文件中禁用PHP脚本的持久连接:
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent=Off
Scripts won't fail, they'll just use non-persistent connections silently.
脚本不会失败,它们只是静默地使用非持久性连接。
#1
You should also configure the open_files_limit and the table_open_cache , but be careful with open_files_limit_value not exceed the OS maximum.
您还应该配置open_files_limit和table_open_cache,但要小心open_files_limit_value不要超过OS最大值。
- Get mysql PID
- list the max open file for my sql using
获取mysql PID
列出我的sql使用的最大打开文件
cat /proc/ PID /limits | grep "open files"
cat / proc / PID / limits | grep“打开文件”
-
In /etc/my.cnf configure the following
在/etc/my.cnf中配置以下内容
open_files_limit= 4096 #the maximum of the OS
open_files_limit = 4096#操作系统的最大值
max_connections = 500
max_connections = 500
table_open_cache = 600
table_open_cache = 600
restart mysql server using
使用重启mysql服务器
service mysql restart
service mysql restart
#2
You can increase this value in main config file (e.g., /etc/my.cnf) using this syntax:
您可以使用以下语法在主配置文件(例如/etc/my.cnf)中增加此值:
[mysqld]
set-variable=max_connections=250
If it not work then either execute SET GLOBAL max_connections = 250;
in MySQL and restart MySQL.
如果它不起作用则执行SET GLOBAL max_connections = 250;在MySQL中重启MySQL。
NOTE:
You can find this error if your scripts open persistent connections, wich aren't closed even if the script terminates. Use mysql_connect() instead of mysql_pconnect() unless you have a good reason. In particular, check this setting in third-party scripts (such as osCommerce).
如果脚本打开持久连接,即使脚本终止也未关闭,您可以找到此错误。除非有充分的理由,否则请使用mysql_connect()而不是mysql_pconnect()。特别是,请在第三方脚本(例如osCommerce)中检查此设置。
Server administrators can disable persistent connections for PHP scripts in php.ini file:
服务器管理员可以在php.ini文件中禁用PHP脚本的持久连接:
[MySQL]
; Allow or prevent persistent links.
mysql.allow_persistent=Off
Scripts won't fail, they'll just use non-persistent connections silently.
脚本不会失败,它们只是静默地使用非持久性连接。