mysql怎么调试啊?

mysql怎么调试啊?

我有一台在 VMware 下运行的虚拟机(Ubuntu 12.04,MySQL 5.5),专门用于托管 mysql 服务器。我通过内部 IP 连接到该服务器。

我正在尝试找出出现mysql server has gone错误的原因。我的一台 Windows 机器上的 Apache 因这个问题而停止运行。我一直尝试使用以下参数微调我的 mysql my.cnf,但没有得到想要的结果。

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
 bind-address           = 0.0.0.0
#
# * Fine Tuning
#
wait_timeout = 180
key_buffer              = 384M
max_allowed_packet      = 64M
thread_stack            = 192K
thread_cache_size       = 8
# This replaces the startup script and checks MyISAM tables if needed
# the first time they are touched
myisam-recover         = BACKUP
max_connections        = 500
table_cache            = 64
#thread_concurrency     = 10
#
# * Query Cache Configuration
#
query_cache_limit       = 1M
query_cache_size        = 32M

如何调试该问题,配置中缺少什么以避免此错误?

答案1

这是一个非常普遍且令人烦恼的错误。

您可以尝试在 mysql 服务器端增加超时时间(不仅是等待超时,还有连接超时)....当您在 mysql shell 上手动运行查询时,查询运行了多长时间?比超时时间还长?那是一个问题。

它可能出现在应用程序端,例如,如果您正在使用 php,如果代码达到 max_execution_time [sic],那么您可能会看到此错误。

此外,mysql 变量 max_packet [sic] 将导致此错误,并且通常发生在导入 mysqldumps 时。

最后,如果您对 tcp/3306(或 mysql 正在监听的任何内容)设置了 iptables 速率限制,您可能会看到这是由于数据包丢失造成的。

简而言之,尝试一次提高 mysql 端和应用程序端的所有限制/超时,并重复直到修复。

相关内容