《MysqL学习MysqL too many open connections问题解决方法》要点:
本文介绍了MysqL学习MysqL too many open connections问题解决方法,希望对您有用。如果有疑问,可以联系我们。
曾经以为在my.cnf写入max_connections = 2000
就可以改变MysqL的最大并发量,本日查到一个命令,发现服务器的MysqL最大连接数为151.MysqL数据库
代码如下:
show variables;
这条命令可以看到所有基础配置
如果单独看max_connections可以这样
MysqL数据库
代码如下:
show variables like 'max%';
+―――――――――-+――――+
| Variable_name | Value |
+―――――――――-+――――+
| max_allowed_packet | 1048576 |
| max_binlog_cache_size | 4294963200 |
| max_binlog_size | 1073741824 |
| max_connect_errors | 10 |
| max_connections | 151 |
| max_delayed_threads | 20 |
| max_error_count | 64 |
| max_heap_table_size | 16777216 |
| max_insert_delayed_threads | 20
151 好像是lampp默认的最大连接数.
代码如下:
max_connections=2000
# The MysqL server
[MysqLd]
port = 3306
socket = /Applications/XAMPP/xamppfiles/var/MysqL/MysqL.sock
改完以后
代码如下:
然后把max_connections=2000移动到[MysqLd]下面,重启动MysqL
代码如下:
+―――――――――-+――――+
| Variable_name | Value |
+―――――――――-+――――+
| max_allowed_packet | 1048576 |
| max_binlog_cache_size | 4294963200 |
| max_binlog_size | 1073741824 |
| max_connect_errors | 10 |
| max_connections | 2000 |
| max_delayed_threads | 20 |
| max_error_count | 64 |
| max_heap_table_size | 16777216 |
| max_insert_delayed_threads | 20
说明这配置必需在[MysqLd]下面,才有用.MysqL数据库
欢迎参与《MysqL学习MysqL too many open connections问题解决方法》讨论,分享您的想法,编程之家PHP学院为您提供专业教程。