Home > Database > Mysql Tutorial > MySQL导入sql脚本错误:2006 解决方法_MySQL

MySQL导入sql脚本错误:2006 解决方法_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-01 12:59:22
Original
1255 people have browsed it

MySQL导入sql脚本错误:2006 - MySQL server has gone away

到如一些小脚本很少报错,但最近导入一个10+M的SQL脚本,却重复报错:

Error occured at:2014-03-24 11:42:24
Line no.:85
Error Code: 2006 - MySQL server has gone away

Copy after login

最终找到原因,原来是MySQL导入大批量数据的时候超出了默认允许最大的数据包所以就提示2006 - MySQL server has gone away

于是找到my.cnf,在[mysqld]加入:

max_allowed_packet=300M
wait_timeout=200000
interactive_timeout = 200000

Copy after login

意思是最大允许数据包300M,等待超时/活动失效时常200000秒,重启MySQL

[root@lizhong 20140323]# /etc/init.d/mysqld restart
Shutting down MySQL.... SUCCESS! 
Starting MySQL. SUCCESS!
Copy after login

再重新导入,一切正常!

以上所述就是本文的全部内容了,希望大家能够喜欢。

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
Latest Issues
MySQL stops process
From 1970-01-01 08:00:00
0
0
0
Error when installing mysql on linux
From 1970-01-01 08:00:00
0
0
0
phpstudy cannot start mysql?
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template