网站地图    收藏   

主页 > 后端 > mysql数据库 >

#2006-MySQLserverhasgoneaway - mysql数据库栏目 - 自学p

来源:自学PHP网    时间:2015-04-16 10:51 作者: 阅读:

[导读] 2006 - MySQL server has gone away 对于web应用来说,经常会用到mysql,而数据的备份与还原是web应用经常做的事,一般来说,用客户端工具phpmyadmin,sqlyog 等,来备份数据库没有任何问题,还原...

#2006 - MySQL server has gone away

对于web应用来说,经常会用到mysql,而数据的备份与还原是web应用经常做的事,一般来说,用客户端工具phpmyadmin,sqlyog 等,来备份数据库没有任何问题,还原时经常碰到mysql提示的#2006错误。

Error: 2006 (CR_SERVER_GONE_ERROR)

Message: MySQL server has gone away

原因可能是sql语句过长,超过mysql通信缓存区最大长度;

调整mysql配置文件中max_allowed_packet

mysql配置文件mysql ini(部分)

# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is C:\mysql\data) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.

# The following options will be passed to all MySQL clients
[client]
#password	= your_password
port		= 3306
socket		= /tmp/mysql.sock

# Here follows entries for some specific programs

# The MySQL server
[wampmysqld]
#mysql端口
port		= 3306
socket		= /tmp/mysql.sock
#索引缓存区,决定你索引查询时能访问速度
key_buffer_size = 16M
#通信缓存区最大长度,决定你sql语句中字符串最大长度
max_allowed_packet = 1M
#排序缓存区,决定你orderby的速度
sort_buffer_size = 512K
#通信缓存区大小,查询时默认该值为通信缓存区大小,若不够会自动增加直到达到max_allowed_packe
net_buffer_length = 8K

read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M


自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习

京ICP备14009008号-1@版权所有www.zixuephp.com

网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com

添加评论