2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > 解决Mysql错误1040 Too many connections的方法

解决Mysql错误1040 Too many connections的方法

时间:2023-12-13 09:10:44

相关推荐

解决Mysql错误1040 Too many connections的方法

解决mysql 1040错误Too many connections的方法

错误信息如下:

Can not connect to MySQL server Error: Too many connectionsErrno.: 1040

Similar error report has beed dispatched to administrator before.

从官方文档知道linux上面编译安装的mysql默认的连接为100个,这样对于网站的需求来说是远远不够的。

文档:/doc/refman/5.0/en/too-many-connections.html

If you get a Too many connections error when you try to connect to the mysqld server, this means that all available connections are in use by other clients.

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.

MySQL官方告诉我们需要修改max_connections的值,那么我们怎么去修改呢?有两种方法

1、修改配置文件文件

修改/etc/f这个文件,在[mysqld]中新增max_connections=N,如果你没有这个文件请从编译源码中的support-files文件夹中复制你所需要的*.cnf文件为到/etc/f。我使用的是my-f,中型服务器配置。例如我的[mysqld]的内容如下

[mysqld]port = 3306socket= /tmp/mysql.sockskip-lockingkey_buffer = 160Mmax_allowed_packet = 1Mtable_cache = 64sort_buffer_size = 512Knet_buffer_length = 8Kread_buffer_size = 256Kread_rnd_buffer_size = 512Kmyisam_sort_buffer_size = 8Mmax_connections=1000

由于对mysql还不是很熟悉,所以很多参数没有修改。哈哈。。

2、非使用mysqld脚本自动启动的用户。

修改$MYSQL_HOME/bin/mysqld_safe文件

例如:/usr/local/mysql/bin/mysqld_safe这个文件

grep -n 'max_connection' $MYSQL_HOME/bin/mysqld_safe

修改对应行号的max_connections参数值

专业墙纸贴纸厨房用具装饰出售,本人网店经营

博客对你有用记得访问下哦,增加下访问量,如有需要可以下单购买哦^_^。/item.htm?id=569617707364

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。