场景: 使用.sql 文件 导入一个数据库备份时, 报错如下:
10:35:12 Restoring D:\Mine\ichangtou\DataBase.sql
Running: mysql.exe --defaults-extra-file="c:\users\admini~1\appdata\local\temp\tmpn9oimb.cnf" --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments < "D:\\Mine\\xxx\\DataBase.sql"
ERROR 2006 (HY000) at line 548708: MySQL server has gone away
Operation failed with exitcode 1
10:38:35 Import of D:\Mine\xxx\DataBase.sql has finished with 1 errors
------------------------------------------------------------------------------
解决方法:
加入以下配置项到 my.ini
wait_timeout=2880000
interactive_timeout = 2880000 ##增大timeout时间
max_allowed_packet = 10M ##控制其通信缓冲区的最大长度,比如插入大数据到一个字段 text 图片之类的
=================================================
参考文档:http://www.cnblogs.com/bisonjob/archive/2009/08/18/1548611.html