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!
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:
- [Solved] Error Code: 2013. Lost connection to MySQL server during query
- Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution
- MySQL Workbench: Error Code: 1175 [How to Solve]
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..
- [Solved] MYSQL Command Execute Error: Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “
- mysql workbench Error Code: 1046. No database selected Select the default DB to be used by doubl
- MySql Install Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘
- IDEA maven Config MYSQL Connection Error: Could not create connection to database server.
- MYSQL Enter password:ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- MYSQL Insert Data Error: check the manual that corresponds to your MySQL server version for the right syntax
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- host ‘‘ is not allowed to connect to this mysql server Connect MYSQL Error
- MySQL 8.0 error 1114 (HY000): the table’sbtest1’is full (Fixed)
- How to Solve MYSQL Error: Failed to start MySQL 8.0 database server
- C# Connect MYSQL Error: MySql.Data.MySqlClient.MySqlException:“SSL Connection error.”
- [Solved] com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server.