首页 > 代码库 > mysql在导入大数据库的时候,报错ERROR 2006 (HY000): MySQL server has gone away

mysql在导入大数据库的时候,报错ERROR 2006 (HY000): MySQL server has gone away

 

或者,报错信息:


ERROR 2005 (HY000): Unknown MySQL server host ‘10997107101114‘ (0)
ERROR:
Can‘t connect to the server

No connection. Trying to reconnect...

=======================

解决办法:

mysql> show global variables like ‘max_allowed_packet‘;

mysql> set global max_allowed_packet=1024*1024*16;

mysql> show global variables like ‘max_allowed_packet‘;

 

技术分享

 =======================

unknown command ‘\n‘ 这种导入数据库的时候,会发生这个错误,有关系吗?

技术分享

 

      DOS报错error at line XXX:unknown command ‘\n‘
         

这种情况一般是字符集不对应引起的,如果数据库是utf8编码,则
         mysql导入的时
         mysql -uroot -ppasswd <d:\aa.sql --default-character-set=utf8
         同样如果数据库是gbk,则导入时
         mysql -uroot -ppasswd <d:\aa.sql --default-character-set=gbk

mysql在导入大数据库的时候,报错ERROR 2006 (HY000): MySQL server has gone away