我有MySQL 5.5.20和这个表:
mysql> desc country;
+----------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+-------+
| id | int(255) | NO | PRI | NULL | |
| iso | varchar(2) | NO | | NULL | |
| name | varchar(80) | NO | | NULL | |
| printable_name | varchar(80) | NO | | NULL | |
| iso3 | varchar(3) | YES | | NULL | |
| numcode | smallint(6) | YES | | NULL | |
+----------------+-------------+------+-----+---------+-------+
如果我运行这样的查询
SELECT country.ID, country.ISO, country.NAME,
country.PRINTABLE_NAME, country.ISO3, country.NUMCODE
FROM country;
它返回:
ERROR 2013 (HY000): Lost connection to MySQL server during query
如果我更改列的顺序(例如PRINTABLE_NAME之前的ISO3),请执行以下操作:
SELECT country.ID, country.ISO, country.NAME,
country.PRINTABLE_NAME, country.NUMCODE, country.ISO3
FROM country;
一切正常!
或者如果我使用小写字母为列重写查询,它也可以。
此问题不时出现(大约每月一次),解决它的唯一解决方案是重启MySQL!我已经检查了错误日志,这就是我所拥有的:
130310 11:01:23 [Warning] /usr/sbin/mysqld: Forcing close of thread 401108 user: 'root'
我真的很困惑,不知道为什么会这样!关于如何解决这个问题的任何想法?