mysql导入sql文件时不退出,导入大型sql文件时,MySQL Server已消失

I tried to import a large sql file through phpMyAdmin...But it kept showing error

'MySql server has gone away'

What to do?

解决方案

As stated here:

Two most common reasons (and fixes) for the MySQL server has gone away

(error 2006) are:

Server timed out and closed the connection. How to fix:

check that wait_timeout variable in your mysqld’s my.cnf configuration file is large enough. On Debian: sudo nano

/etc/mysql/my.cnf, set wait_timeout = 600 seconds (you can

tweak/decrease this value when error 2006 is gone), then sudo

/etc/init.d/mysql restart. I didn't check, but the default value for

wait_timeout might be around 28800 seconds (8 hours).

Server dropped an incorrect or too large packet. If mysqld gets a packet that is too large or incorrect, it assumes that something has

gone wrong with the client and closes the connection. You can increase

the maximal packet size limit by increasing the value of

max_allowed_packet in my.cnf file. On Debian: sudo nano

/etc/mysql/my.cnf, set max_allowed_packet = 64M (you can

tweak/decrease this value when error 2006 is gone), then sudo

/etc/init.d/mysql restart.

Edit:

Notice that MySQL option files do not have their commands already available as comments (like in php.ini for instance). So you must type any change/tweak in my.cnf or my.ini and place them in mysql/data directory or in any of the other paths, under the proper group of options such as [client], [myslqd], etc. For example:

[mysqld]

wait_timeout = 600

max_allowed_packet = 64M

Then restart the server. To get their values, type in the mysql client:

> select @@wait_timeout;

> select @@max_allowed_packet;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值