03-19 pymysql.err.OperationalError: (2013, ‘Lost connection to MySQL server during query‘)

1、问题 bug:

	pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')

SQL dialect is not configured.

未配置SQL方言;

The above exception was the direct cause of the following exception:

上面的异常是以下异常的直接原因:

参考文章:

	https://blog.csdn.net/ambertian/article/details/70238020

03-19 pymysql.err.OperationalError: (2013, ‘Lost connection to MySQL server during query‘)_第1张图片
在cmd中ping localhost解析出来的是IPV6的::1,原因是windows有个优先解析列表,当ipv6的优先级高于ipv4时,就会出现这种情况

03-19 pymysql.err.OperationalError: (2013, ‘Lost connection to MySQL server during query‘)_第2张图片
然后修改优先级:

现在需要设置使::/96、::ffff:0:0/96的优先级高于::/0和::1/128,在命令行中依次设置优先级:

netsh int ipv6 set prefix ::/96 50 0
netsh int ipv6 set prefix ::ffff:0:0/96 40 1
netsh int ipv6 set prefix 2002::/16 35 2
netsh int ipv6 set prefix 2001::/32 30 3
netsh int ipv6 set prefix ::1/128 10 4
netsh int ipv6 set prefix ::/0 5 5
netsh int ipv6 set prefix fc00::/7 3 13
netsh int ipv6 set prefix fec0::/10 1 11
netsh int ipv6 set prefix 3ffe::/16 1 12

03-19 pymysql.err.OperationalError: (2013, ‘Lost connection to MySQL server during query‘)_第3张图片
再查看优先级:
03-19 pymysql.err.OperationalError: (2013, ‘Lost connection to MySQL server during query‘)_第4张图片

你可能感兴趣的:(BUG)