我最近从 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
答案1
首先,删除这里发布的“skip-bdb”行:Mysql-Server-5.1升级问题
答案2
似乎有一个详细的错误报告这解释了这个错误,并提出了增加参数的可能解决方案connect_timeout
。