When using Navicat 12 for MySQL, when running the SQL file, an error is reported:[ERR]2013 – Lost Connection to MySQL Server During Query

运行 SQL 文件时,报错:[ERR] 2013 - Lost connection to MySQL server during query

1. When running the SQL file, an error is reported:[ERR]2013 – Lost Connection to MySQL Server During During Query, as shown in Figure 1
[错误]2013 – Loss of connection to mysql server during query

运行 SQL 文件时,报错:[ERR] 2013 - Lost connection to MySQL server during query
Figure 1
2. Open the directory C:\ProgramData\MySQL\MySQL Server 5.7, edit the my.ini file, as shown in Figure 2

打开目录 C:\ProgramData\MySQL\MySQL Server 5.7,编辑 my.ini 文件
Figure 2

3. Change max_allowed_packet=4m to max_allowed_packet=256m, as shown in Figure 3

将 max_allowed_packet=4M 修改为 max_allowed_packet=256M
Figure 3

4. Stop the MySQL server, as shown in Figure 4

停止 MySQL 服务器
Figure 4

5. Run the MySQL server, as shown in Figure 5

运行 MySQL 服务器
Figure 5

6. Run the SQL file again, the encoding is selected: 65001 (UTF-8), as shown in Figure 6

再次运行 SQL 文件,编码选择:65001 (UTF-8)
Figure 6

7. The operation is successful, and there is no error, as shown in Figure 7

运行成功,无报错
Figure 7

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.