今天发现生产机上MYSQL有如下报错:[select count(*) from black where ver>'10120401']
<2002-Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'>[insert into data values( 21495, '2010-12-26 21:15:10', 004700, '260101114002', '\'bd\'bb\'d2\'d7\'c3\'f7\'cf\'b8', '\'c5\'fa\'d7\'bc', '15347581310200087823', '2010-12-26 15:04:10', 29.80, 139.10, '260101114', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )]
<2013-Lost connection to MySQL server during query>[select count(*) from black where ver>'10120401']
<1040-Too many connections>这台机器原来是正常工作将近4,5的 最近因为应用需求大约增加了1/4的客户端数量 然后就开始在应用日志中出现这些问题
出现问题以后 有的时候服务器会自行恢复正常 但有的时候需要重启服务器才能解决请问各位大虾是为什么 该如何解决 谢谢 另外哪里可以看到mysql自己的数据库日志
机器是linux平台的
<2002-Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'>[insert into data values( 21495, '2010-12-26 21:15:10', 004700, '260101114002', '\'bd\'bb\'d2\'d7\'c3\'f7\'cf\'b8', '\'c5\'fa\'d7\'bc', '15347581310200087823', '2010-12-26 15:04:10', 29.80, 139.10, '260101114', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )]
<2013-Lost connection to MySQL server during query>[select count(*) from black where ver>'10120401']
<1040-Too many connections>这台机器原来是正常工作将近4,5的 最近因为应用需求大约增加了1/4的客户端数量 然后就开始在应用日志中出现这些问题
出现问题以后 有的时候服务器会自行恢复正常 但有的时候需要重启服务器才能解决请问各位大虾是为什么 该如何解决 谢谢 另外哪里可以看到mysql自己的数据库日志
机器是linux平台的
解决方案 »
- mysql怎么没有configure这玩意~~
- sql server 2005 按位操作怎么写。急!!!!!在线
- mysql的root密码忘记了肿么办?
- 请问,如何使用mysql的正则来找出符合要求的数据
- Mysql表空间的问题
- 如何用arm-linux-gcc编译mysql C啊?
- Table 'mydatabase.pet' doesn't exist
- 我误删除了 user 表,如果不重新安装的话,如何恢复?用的是linux
- 求解决方法:mysql怎样自动实现下面图片中的效果?
- 怎样在Xteamlinux下让PHP跑起来?我选择的是完全安装,Apache,mysql,PHP都装了,可是PHP却不好使?
- Mysql主从复制出错,sql线程终止!
- mysql无法登陆
1040-Too many connections
估计楼主的的connections 设置要加大一点;
http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
http://community.csdn.net/Help/HelpCenter.htm#结帖
show status like 'Threads_connected';
但是还是会有<2013-Lost connection to MySQL server during query>
请各位大大 再帮忙看看 谢谢了
101230 14:02:06 /usr/sbin/mysqld: Can't create/write to file '/var/run/mysqld/mysqld.pid' (Errcode: 2)
/usr/sbin/mysqld: ready for connections.
Version: '4.0.20-log' socket: '/var/lib/mysql/mysql.sock' port: 3306
101230 14:02:16 Aborted connection 2 to db: 'monitor' user: 'root' host: `localhost' (Got an error reading communication packets)
101230 14:02:20 Aborted connection 3 to db: 'monitor' user: 'root' host: `localhost' (Got an error reading communication packets)
101230 14:02:24 Aborted connection 5 to db: 'monitor' user: 'root' host: `localhost' (Got an error reading communication packets)
101230 14:02:28 Aborted connection 6 to db: 'monitor' user: 'root' host: `localhost' (Got an error reading communication packets)
101230 14:02:39 Aborted connection 7 to db: 'monitor' user: 'root' host: `localhost' (Got an error reading communication packets)
101230 14:03:34 Aborted connection 8 to db: 'monitor' user: 'root' host: `localhost' (Got an error reading communication packets)
101230 14:04:06 Aborted connection 9 to db: 'monitor' user: 'root' host: `localhost' (Got an error reading communication packets)
101230 14:06:00 Aborted connection 10 to db: 'monitor' user: 'root' host: `localhost' (Got an error reading communication packets)中间都这个错误 所以省略 下面只贴最后一行101230 23:13:43 mysqld ended在应用程序日志看到的错误是
20101230222540-ER: [select count(*) from black where ver>'10120401']:<2013-Lost connection to MySQL server during query>!
20101230231352-ER: [select * from term where term_id='000001004852']<2002-Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)>!出现问题时 手工也无法登陆mysql 要重启服务器后 才能解决
经常会有使用mysql的朋友会发现error.log中有大量的
[Warning] Aborted connection 。。(Got an error reading communication packets)
对于这样的警告日志,大致从下面两个方面排查
1网络问题,网络是否存在问题,花费了超过 connect_timeout 的时间去得到一个数据包
2账号密码是否正确
3客户端是否有权限连接该数据库
4连接包是不是有带有正确的信息如果都不是上面的问题,可以尝试加大max_allowed_packet_size,或者使用php的短连接,不使用长连接,再或者每次查询完成后关闭连接,避免The client had been sleeping more than wait_timeout or interactive_timeout seconds without issuing any requests to the server.(客户端连接休眠时间超过wait_timeout,interactive)
实在没招了,可以大概general query log,把所有查询的sql都列出来。
还是解决不了,就是更底层的原因了,网络设备故障等等。详细见参考
参考http://dev.mysql.com/doc/refman/5.1/en/communication-errors.html
我修改了max_allowed_packet 可是问题依旧
另外服务器与mysql数据库是一台机器 应该不存在网络问题
20101230222540-ER: [select count(*) from black where ver>'10120401']:<2013-Lost connection to MySQL server during query>!
20101230231352-ER: [select * from term where term_id='000001004852']<2002-Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)>!这两张表里的数据 black 不超过200条记录 term 不超过4000条记录 其他表只有
[insert into data values( 21495, '2010-12-26 21:15:10', 004700, '260101114002', '\'bd\'bb\'d2\'d7\'c3\'f7\'cf\'b8', '\'c5\'fa\'d7\'bc', '15347581310200087823', '2010-12-26 15:04:10', 29.80, 139.10, '260101114', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL )]
但是这个表的数据被另一个程序取走后 是会被删除的系统原先已经正常运行了5,6年了 就最近一个星期出现这样的问题(没有做过改动) 我感觉束手无策啊
检查下所有表。
感谢大家给予的帮助 O(∩_∩)O