I'm migrating data from magento to Magento 2 and get the following error:

MySQL server has gone away

enter image description here

  • Please check your MySQL "wait_timeout" variable to make sure MySQL is not closing the database connection early.
    – user35138
    Jan 15, 2016 at 17:40

1 Answer 1


I had the same problem and solved it by increasing the following value in the /etc/mysql/my.cnf mysql configuration file:

max_allowed_packet=4000M # just set it to 4000M because on my dev machine i don't care

Be carefull to not change the mysqldump option, there is also a max_allowed_packet

I also added this line to set the wait_timeout in the same configuration file:

  • 1
    Late to this party. Could you confirm with SELECT @@max_allowed_packet size is 4G? Most version documentation indicates the Range is up to 1G. Error log many indicate at startup a different max available. Jul 4, 2018 at 0:26
  • I can't confirm this. Maybe it just uses the max value from 1GB when setting it to a bigger value. But 1GB will be way enough anyways.
    – bpoiss
    Jul 4, 2018 at 9:32
  • @bpoiss can you confirm the path for my.cnf file. i am using xampp server. migration m1.9.3.6 to m2.3.3 Jan 18, 2020 at 7:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.