ERROR 2006 (HY000) at line 1: MySQL server has gone away

前端 未结 6 618
有刺的猬
有刺的猬 2021-02-05 09:07

ERROR 2006 (HY000) at line 1: MySQL server has gone away

I am facing the same problem. I am trying to restore mysqldump file to my machine. The file have size of 2.7 MB

6条回答
  •  孤街浪徒
    2021-02-05 09:22

    Under [mysqld] I have tried the following:

    max_allowed_packet = 2096M
    

    restarted mysqld and it did not work, however what worked for me is to set max_allowed_packet globally from command line and then run the export from dump, it went through without any issues.

    You can start from smaller packet size depending on database, I also did reimport my database with same size.

    For Export:-

    mysqldump --opt --user=confluenceUser --password='' --max_allowed_packet=2147483648 confluencedb | gzip > confluencedb.sql.gz
    

    For Import:-

    mysql> SET GLOBAL max_allowed_packet=2147483648;
    
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    zcat confluence.sql.gz | mysql -uconfluence -p confluencedb
    

提交回复
热议问题