(Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query

When creating a new table in MySQL, the problem of Lost Connection to MySQL occurred. Many methods were found on the Internet to modify timeout, max_allowed_packet.
One way is to change the value in CMD, but the default value will be restored after I restart mysql. Here is how to change the value.
Show Global variables like ‘max_allowed_packet’; If you look at the space, the current space is only 1048576 bytes, 1M

Use the set global max_allowed_packet = 20971520; Can be used to set the size of the space, here set to 20M

Use this command to view timeout and modify value in the same way as above
The second method is modified in /etc/my.cnf. This method will not revert to the default value after MySQL is restarted. I have extended the timeout, but the program still ends at 30s.
All of the above methods didn’t work, and later I read other blogs that there was a problem with the MySQL UI interface and data connection, so I finally executed the create Table statement in CMD successfully!


Read More: