ERROR 2006 (HY000): MySQL server has gone away Resolved
Having problem importing your SQL dump, be it via command line or via container management console, here is the solution.
$ ./mysql -u root -p my_db < file.sql Enter password: ERROR 2006 (HY000) at line 1: MySQL server has gone away
Error Message: ERROR 2006 (HY000): MySQL server has gone away, see above.
Description: This is caused by SQL import file being too big or field carrying too much information, causing it to exceed the max_allowed_packet setting.
System: Linux
Solution: increase the maximum allowed packet by changing the parameter in my.cnf file will resolve this problem.
Steps:
1. SSH or SFTP to the Server
2. Look for my.cnf with whereis command or
3. my.cnf can be found on linux: /etc/mysql
4. Add the following line to my.cnf
max_allowed_packet=64M
5. Save and close the file
6. Restart MySQL server using or Restart the Server
sudo service mysql restart
7. Try importing the SSL file again.
Ubah Max Upload Lampp/xampp di Ubuntu | Priana Saputra
13 October 2021 @ 3:02 pm
[…] ref2: https://www.xelium.co.uk/2020/05/error-2006-hy000-mysql-server-has-gone-away-resolved/ […]
Mauricio
2 December 2021 @ 3:48 am
Excellent! You save me hours!
RamJam
14 December 2022 @ 5:59 am
Thank you
B SANDEEP
23 March 2023 @ 10:42 am
Use
max_allowed_packet = 1G
For morethen 8gb database