mysql 1040错误提示Too many connections的解决方法
发布:smiling 来源: PHP粉丝网 添加日期:2014-10-12 15:39:50 浏览: 评论:0
最简单的办法是因为你的my.ini中设定的并发连接数太少或者系统繁忙导致连接数被占满 解决方式:打开MYSQL安装目录打开MY.INI找到max_connections默认是100 .
实例:WINDOWS解决MYSQL Errno.:1040错误
- XXXX info: Can not connect to MySQL server
- User: root
- Time: 2004-5-20 3:00pm
- Script: /XXXX/XXXX.php
- Error: Too many connections
- Errno.: 1040
- An error report has been dispatched to our administrator.
上面错误观点提示:
1.可能是mysql的max connections设置的问题
2.可能是多次insert,update操作没有关闭session,需要在spring里配置transaction支持。
解决:
1.修改tomcat里的session 的time-out时间减少为20,(不是必改项)
2.对处理量大的对数据库insert或update的操作提供transaction支持.
下面的是解决办法,代码如下:
- com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"
原因:因为你的mysql安装目录下的my.ini中设定的并发连接数太少或者系统繁忙导致连接数被占满.
解决方式:打开MYSQL安装目录打开MY.INI找到max_connections(在大约第93行)默认是100 一般设置到500~1000比较合适,重启mysql,这样1040错误就解决啦。
max_connections=1000
一定要重新启动MYSQL才能生效,代码如下:
- CMD->
- net stop mysql
- net start mysql
关于改变innodb_log_file_size后无法启动mysql的问题,代码如下:
- innodb_buffer_pool_size=768M
- innodb_log_file_size=256M
- innodb_log_buffer_size=8M
- innodb_additional_mem_pool_size=4M
- innodb_flush_log_at_trx_commit=0
- innodb_thread_concurrency=20
- --phpfensi.com
以上是对innodb引擎的初步优化,发现是更新innodb_log_file_size=256M时候出现了问题,只要加上这个就无法启动,后来才知道原来要STOP服务先,然后再删除原来的文件………
打开/MySQL Server 5.5/data,删除ib_logfile0, ib_logfile1........ib_logfilen,再开启选项,成功启动.
高手优化的MYSQL my.ini的1000人在线配置,代码如下:
- #This File was made using the WinMySQLAdmin 1.4 Tool
- #2004-2-23 16:28:14
- #Uncomment or Add only the keys that you know how works.
- #Read the MySQL Manual for instructions
- [mysqld]
- basedir=D:/mysql
- #bind-address=210.5.*.*
- datadir=D:/mysql/data
- #language=D:/mysql/share/your language directory
- #slow query log#=
- #tmpdir#=
- #port=3306
- set-variable = max_connections=1500
- skip-locking
- #skip-networking
- set-variable = key_buffer=384M
- set-variable = max_allowed_packet=1M
- set-variable = table_cache=512
- set-variable = sort_buffer=2M
- set-variable = record_buffer=2M
- set-variable = thread_cache=8
- # Try number of CPU's*2 for thread_concurrency
- set-variable = thread_concurrency=8
- set-variable = myisam_sort_buffer_size=64M
- #set-variable = connect_timeout=5
- #set-variable = wait_timeout=5
- server-id = 1
- [isamchk]
- set-variable = key_buffer=128M
- set-variable = sort_buffer=128M
- set-variable = read_buffer=2M
- set-variable = write_buffer=2M
- [myisamchk]
- set-variable = key_buffer=128M
- set-variable = sort_buffer=128M
- set-variable = read_buffer=2M
- set-variable = write_buffer=2M
- [WinMySQLadmin]
- Server=D:/mysql/bin/mysqld-nt.exe
Tags: mysql1040 connections
相关文章
- ·mysql 1040 Too many connections错误(2014-10-08)
- ·MYSQL提示 max_open_files: 2048 max_connections: 800 table_cache: 619(2014-09-23)
- ·Mysql "Too many connections"错误解决办法(2014-09-24)
- ·ERROR 1040: Too many connections问题解决办法(2014-09-28)
- ·mysql ERROR 1040: Too many connections(2014-10-02)
- ·Mysql “Too many connections” 的解决方法(2014-10-04)
- ·LInux网站提示“Too many connections”的解决方法(2014-10-09)
- ·mysql出现too many connections错误提示(2014-10-14)
- ·mysql too many connections(2014-10-17)
推荐文章
热门文章
最新评论文章
- 写给考虑创业的年轻程序员(10)
- PHP新手上路(一)(7)
- 惹恼程序员的十件事(5)
- PHP邮件发送例子,已测试成功(5)
- 致初学者:PHP比ASP优秀的七个理由(4)
- PHP会被淘汰吗?(4)
- PHP新手上路(四)(4)
- 如何去学习PHP?(2)
- 简单入门级php分页代码(2)
- php中邮箱email 电话等格式的验证(2)