DBMNG数据库管理与应用

才能是来自独创性。独创性是思维、观察、理解和判断的一种独特的方式。
当前位置:首页 > MySQL > 管理工具

SQLyog恢复数据库报错解决方法【Error Code: 2006 - MySQL server has gone away】

导入数据库的时候 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;

这个挺好使的,改完之后不用重启服务,直接好使了

本站文章内容,部分来自于互联网,若侵犯了您的权益,请致邮件chuanghui423#sohu.com(请将#换为@)联系,我们会尽快核实后删除。
Copyright © 2006-2023 DBMNG.COM All Rights Reserved. Powered by DEVSOARTECH            豫ICP备11002312号-2

豫公网安备 41010502002439号