从MySQL 4升级到Mysql 5 – 同my.cnf – 大量的随机断开连接

我最近从MySQL4移动到MySQL5(我们有应用程序需要MySQL4,我们最终取代)

从那以后,我一直有很多类似的问题:

connect() failed: Lost connection to MySQL server at 'reading initial communication packet', system error: 0 

是的,那是系统错误0 – “成功”。

我不知道为什么会发生这种情况 – 但是想知道为什么

这是我的(净化)my.cnf

 [client] port = 3306 socket = /var/run/mysqld/mysqld.sock [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp language = /usr/share/mysql/english skip-external-locking key_buffer = 1048M max_allowed_packet = 16M thread_stack = 2M thread_cache_size = 16384 sort_buffer_size = 256K read_buffer_size = 2M read_rnd_buffer_size = 256K tmp_table_size = 512M max_heap_table_size = 512M query_cache_size = 512M thread_concurrency = 16 set-variable = table_cache=16384 max_connections = 500 wait_timeout = 3600 innodb_buffer_pool_size = 1024M innodb_additional_mem_pool_size = 8M innodb_lock_wait_timeout = 50 innodb_flush_method=O_DIRECT innodb_log_buffer_size = 8M innodb_thread_concurrency = 8 innodb_file_per_table=1 query_cache_limit = 1024M query_cache_size = 512M query_cache_type = 1 server-id = 9 log_bin = /var/log/mysql/mysql-bin.log expire_logs_days = 10 max_binlog_size = 100M expire_logs_days = 3 skip-bdb [mysqldump] quick quote-names max_allowed_packet = 16M [mysql] prompt = (\u@atlas) [\d]>\\_ [isamchk] key_buffer = 16M !includedir /etc/mysql/conf.d/ 

编辑我改变了上面的my.cnf – 我刚刚意识到这是从旧服务器的一个! 另外 – 这是5.0,而不是5.1

首先,摆脱“skip-bdb”这一行: mysql-server-5.1升级问题

似乎有一个详细的错误报告 ,解释这个错误,增加connect_timeout参数的一个可能的解决scheme。