MYSQL Error Code: 2006 – MySQL server has gone away
2013-09-29 11:54
495 查看
导入数据库的时候 SQLyog 报错了
Error Code: 2006 – MySQL server has gone away
搜了下,说是max_allowed_packet (MySQL的一个参数)设置的值不够大。
那我改下就行了 嘿嘿
In Windows:
In the MySQL server installation directory,
in my.ini file, add the following line under [mysqld] in SERVER SECTION.
max_allowed_packet = 16M
In Linux:
Copy the my-xxx.cnf file from /usr/share/mysql to /etc as my.cnf
xxx can be small, medium, large, huge … depending on the requirement.
$ cp /usr/share/mysql/my-xxx.cnf /etc/my.cnf
In the my.cnf file, change the default
max_allowed_packet = 1M
to
max_allowed_packet = 16M
Save the file and restart MySQL server.
今天导入.sql文件时出现了Error Code: 2006 – MySQL server has gone away错误,原来是导入的sql文件大于系统默认的max_allowed_packet的值,查了很多修改配置文件的,但是没有找到my.cfg文件,修改其他文件不管用,所以直接使用sql语句来修改:
SET GLOBAL max_allowed_packet=67108864;
这个挺好使的,改完之后不用重启服务,直接好使了
Error Code: 2006 – MySQL server has gone away
搜了下,说是max_allowed_packet (MySQL的一个参数)设置的值不够大。
那我改下就行了 嘿嘿
In Windows:
In the MySQL server installation directory,
in my.ini file, add the following line under [mysqld] in SERVER SECTION.
max_allowed_packet = 16M
In Linux:
Copy the my-xxx.cnf file from /usr/share/mysql to /etc as my.cnf
xxx can be small, medium, large, huge … depending on the requirement.
$ cp /usr/share/mysql/my-xxx.cnf /etc/my.cnf
In the my.cnf file, change the default
max_allowed_packet = 1M
to
max_allowed_packet = 16M
Save the file and restart MySQL server.
今天导入.sql文件时出现了Error Code: 2006 – MySQL server has gone away错误,原来是导入的sql文件大于系统默认的max_allowed_packet的值,查了很多修改配置文件的,但是没有找到my.cfg文件,修改其他文件不管用,所以直接使用sql语句来修改:
SET GLOBAL max_allowed_packet=67108864;
这个挺好使的,改完之后不用重启服务,直接好使了
相关文章推荐
- Yii 数据库重连告别General error: 2006 MySQL server has gone away
- MySQL导入sql脚本错误:2006 - MySQL server has gone away
- mysql连接报错 '2006, MySQL server has gone away'
- amoeba连接mysql--ERROR 2006 (HY000): MySQL server has gone away
- SQLAlchemy报错“2006, MySQL server has gone away”
- [解决方案]SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
- ERROR 2006 (HY000): MySQL server has gone away
- [解决方案]SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
- ERROR 2006 (HY000) at line xx: MySQL server has gone away 解决方法
- 多任务操作数据库时:2006, 'MySQL server has gone away'
- ERROR 2006 (HY000) at line 1: MySQL server has gone away
- 解决ERROR 2006 (HY000) at line XX: MySQL server has gone away问题
- MySQL server has gone away(error 2006)异常整理
- MySQL(Navicat)运行.sql文件时报错:[Err] 2006 - MySQL server has gone away 的解决方法 背景: 今天导入一个数据量很大的.sql文件时,
- Error Code: 2006 - MySQL server has gone away
- 2012-12-07 19:03 amoeba连接mysql--ERROR 2006 (HY000): MySQL server has gone away
- mysql 同步线程出现ERROR 2006 (HY000): MySQL server has gone away
- mysql出现ERROR : (2006, 'MySQL server has gone away') 原因和解决方案
- MySQL server has gone away (2006) 排查
- SQLyog恢复数据库报错解决方法【Error Code: 2006 - MySQL server has gone away】