数据库教程:mysql too many open connections问题解决方法分享

曾经以为在my.cnf写入max_connections=2000
就可以改变mysql的最大并发量,今天查到一个命令,发现服务器的mysql最大连接数为151.

控制台,连接上mysql
代码如下:
showvariables;
这条命令可以看到所有基础配置

如果单独看max_connections可以这样
代码如下:
showvariableslike’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默认的最大连接数。

my.cnf里大致这样写的
代码如下:
max_connections=2000
#TheMySQLserver
[mysqld]
port           =3306
socket         =/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
改完以后
代码如下:
#TheMySQLserver
[mysqld]
max_connections=2000
port           =3306
然后把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"toomanyconnections"错误之mysql解决方法解决mysql1040错误Toomanyconnections的方法Mysql错误toomanyconnections解决方案mysql连接数设置操作方法(Toomanyconnections)Mysql错误:Toomanyconnections的解决方法

标签: mysql ons 方法 man ns ec connect io op sq any open

mysql中获取一天、一周、一月时间数据的各种sql语句写法

mysql提示Changed limits: max_open_files: 2048 max_connections: 1910 table_cache: 64的解决

上述就是数据库技术:mysql too many open connections问题解决方法分享的全部内容,如果对大家有所用处且需要了解更多关于mysql数据库学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/dtteaching/911094.html

(0)
上一篇 2021年10月24日
下一篇 2021年10月24日

精彩推荐