Home > Database > Mysql Tutorial > body text

怎样正确认识Mysql通信错误和失效连接_MySQL

WBOY
Release: 2016-06-01 13:55:52
Original
929 people have browsed it

  对于连接问题,服务器错误日志是有用的信息源。如果服务器是用“--log-warnings”选项启动的,在错误日志中可能会发现下述消息:

010301 14:38:23 Aborted connection 854 to db: 'users' user: 'josh'

  如果“Aborted connections”(放弃连接)消息出现在错误日志中,可能的原因是:

  1.客户端程序在退出之前未调用MySQL_close()。

  2.客户端的空闲时间超过wait_timeout或interactive_timeout秒,未向服务器发出任何请求。

  3.客户端在数据传输中途突然结束。

  出现这类情况时,服务器将增加“Aborted_clients”(放弃客户端)状态变量。

  出现下述情况时,服务器将增加“Aborted_clients”(放弃客户端)状态变量。

  ?客户端不具有连接至数据库的权限。

  ?客户端采用了不正确的密码。

  ?连接信息包不含正确信息。

  ?获取连接信息包的时间超过connect_timeout秒。

  如果出现这类情况,可能表明某人正试图侵入你的服务器!

  对于放弃客户端或放弃连接问题,其他可能的源应包括:

  ?与Linux一起使用以太网协议,半双工或全双工。很多Linux以太网驱动均存在该缺陷。应通过FTP在客户端和服务器机器之间传输大文件来测试该缺陷。如果传输处于burst-pause-burst-pause(爆发-暂停-爆发-暂停)模式,表明你遇到了Linux双工故障。唯一的解决方法是,将网卡和Hub/交换器的双工模式切换为全双工或半双工,并对结果进行测试以确定最佳设置。

  ?与线程库有关的某些问题导致读取中断。

  ?配置不良的TCP/IP。

  ?有问题的以太网、Hub、交换器、电缆等。仅能通过更换硬件才能恰当诊断。

  ?变量max_allowed_packet过小或查询要求的内存超过为mysqld分配的内存。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!