我想弄清楚如何诊断一个MySQL连接问题。
这里有两个问题:
你应该使用分析。
set profiling=1;
然后在同一个会话中进行查询。 然后查找configuration文件:
show profiles;
并显示它们:
show profile for query X; ,其中X – 是一些configuration文件。
mysql> show profile for query 2; +--------------------------------+----------+ | Status | Duration | +--------------------------------+----------+ | starting | 0.000042 | | Waiting for query cache lock | 0.000011 | | init | 0.000008 | | checking query cache for query | 0.000081 | | checking permissions | 0.000017 | | Opening tables | 0.000143 | | init | 0.000038 | | System lock | 0.000021 | | optimizing | 0.000020 | | executing | 0.000021 | | end | 0.000013 | | query end | 0.000010 | | closing tables | 0.000027 | | freeing items | 0.000082 | | cleaning up | 0.000198 | +--------------------------------+----------+ 15 rows in set, 1 warning (0.00 sec)