在 Navicat for MySQL 中,导入 SQL 文件,执行时报错:2006 – MySQL server has gone away

1、在 Navicat for MySQL 中,导入 SQL 文件,执行时报错:2006 – MySQL server has gone away。如图1

在 Navicat for MySQL 中,导入 SQL 文件,执行时报错:2006 - MySQL server has gone away

图1

[SQL] Query wshop_store start
[ERR] 2006 - MySQL server has gone away
[ERR] 
INSERT INTO `telescope_entries` VALUES (1,'94d3463e-0bdc-4642-abaa-a02eaa90ad88','94d34642-03d4-45ed-a058-017813472009',NULL,1,'cache','{/"type/":/"hit/",/"key/":/"options-pre-cache/",/"value/":{/"blogname/":/"naivete32/",/"admin_email/":/"admin@localhost.com/",/"timezone_string/":/"Asia///Shanghai/",/"woocommerce_default_customer_address/":/"/",/"woocommerce_currency/":/"USD/",/"customer_service_email/":/"admin@localhost.com/",/"index_seo_title/":/"/",/"index_seo_description/":/"/",/"track_facebook_pixel/":/"/",/"track_ga/":/"/",/"track_google_ads/":/"/",/"track_tiktok_ads/":/"/",/"track_hotjar/":/"/",/"track_lucky_orange/":/"/",/"checkout_member_config/":/"any/",/"checkout_address_2_config/":/"hidden/",/"checkout_phone_config/":/"required/",/"checkout_auto_complete/":/"yes/",/"checkout_edm_config/":/"unchecked/",/"abandoned_checkout_enable/":/"yes/",/"abandoned_checkout_send_after/":/"600/",/"paypal_checkout_position/":/"both/",/"paypal_product_position/":/"no/",/"current_theme/":/"default/",/"auto_tax/":/"yes/",/"password_protected/":/"0/",/"order_number_format/":/"{///"prefix///":null,///"suffix///":null}/",/"intelligence_marketing/":/"0/",/"domain_redirect/":/"enable/",/"checkout_setting/":/"three_step_checkout/",/"preferred_payment_method/":/"paypal/",/"payment_icon/":/"[///"paypal///",///"visa///",///"mastercard///",///"discover///",///"dinersclub///",///"amex///"]/"},/"hostname/":/"fpm.wshop.local/"}','2021-11-08 06:02:54'),(2,'94d3463e-0f1f-429f-b512-0f330e5a8fd5','94d34642-03d4-45ed-a058-017813472009',NULL,1,'cache','{/"type/":/"hit/",/"key/":/"options-pre-cache/",/"value/":{/"blogname/":/"naivete32/",/"admin_email/":/"admin@localhost.com/",/"timezone_string/":/"Asia///Shanghai/",/"woocommerce_default_customer_address/":/"/",/"woocommerce_currency/":/"USD/",/"customer_service_email/":/"admin@localhost.com/",/"index_seo_title/":/"/",/"index_seo_description/":/"/",/"track_facebook_pixel/":/"/",/"track_ga/":/"/",/"track_google_ads/":/"/",/"track_tiktok_ads/":/"/",/"track_hotjar/":/"/",/"track_lucky_orange/":/"/",/"checkout_member_config/":/"any/",/"checkout_address_2_config/":/"hidden/",/"checkout_phone_config/":/"required/",/"checkout_auto_complete/":/"yes/",/"checkout_edm_config/":/"unchecked/",/"abandoned_checkout_enable/":/"yes/",/"abandoned_checkout_send_after/":/"600/",/"paypal_checkout_position/":/"both/",/"paypal_product_position/":/"no/",/"current_theme/":/"default/",/"auto_tax/":/"yes/",/"password_protected/":/"0/",/"order_number_format/":/"{///"prefix///":null,///"suffix///":null}/",/"intelligence_marketing/":/"0/",/"domain_redirect/":/"enable/",/"checkout_setting/":/"three_step_checkout/",/"preferred_payment_method/":/"paypal/",/"payment_icon/":/"[///"paypal///",///"visa///",///"mastercard///",///"discover///",///"dinersclub///",///"amex///"]/"},/"hostname/":/"fpm.wshop.local/"}','2021-11-08 06:02:54'),(3,'94d3463e-10b7-42ce-82a5-af8656f8d02e','94d34642-03d4-45ed-a058-017813472009',NULL,1,'cache','{/"type/":/"hit/",/"key/":/"mainDomain/",/"value/":/"wshop.docker/",/"hostname/":/"fpm.wshop.local/"}','2021-11-08 14:02:54'),(4,'94d3463e-1134-48ae-a984-2e23c03fed15','94d34642-03d4-45ed-a058-017813472009',NULL,1,'cache','{/"type/":/"hit/",/"key/":/"hosted_domain/",/"value/":/"wshop.docker/",/"hostname/":/"fpm.wshop.local/"}','2021-11-08 14:02:54'),(5,'94d3463e-199e-4276-bf08-d0efcb97bc69','94d34642-03d4-45ed-a058-017813472009',NULL,1,'cache','{/"type/":/"missed/",/"key/":/"genealabs:laravel-model-caching::App////Models////Option-cooldown:seconds/",/"hostname/":/"fpm.wshop.local/"}','2021-11-08 14:02:54'),(6,'94d3463e-1a0f-42d6-8a50-9cf08bf7e323','94d34642-03d4-45ed-a058-017813472009',NULL,1,'cache','{/"type/":/"missed/",/"key/":/"genealabs:laravel-model-caching::App////Models////Option-cooldown:invalidated-at/",/"hostname/":/"fpm.wshop.local/"}','2021-11-08 14:02:54'),(7,'94d3463e-1a9f-4f0e-a65a-49a4d94cfea6','94d34642-03d4-45ed-a058-017813472009',NULL,1,'cache','{/"type/":/"missed/",/"key/":/"genealabs:laravel-model-caching::App////Models////Option-cooldown:saved-at/",/"hostname/":/"fpm.wshop.local
[SQL] Finished with error

2、导入的 SQL 文件,其大小为 35MB 左右。如图2

导入的 SQL 文件,其大小为 35MB 左右。

图2

3、原因在于 max_allowed_packet 的默认设置非常低。在 “C:/ProgramData/MySQL/MySQL Server 5.7/my.ini” 将它提高到 40M (MySql 5.7 中默认为 4194304,即 4MB。)

# The maximum size of one packet or any generated or intermediate string, or any parameter sent by the
# mysql_stmt_send_long_data() C API function.
max_allowed_packet=40M

4、重启 MySQL 服务。如图3

重启 MySQL 服务。

图3

5、再次导入 SQL 文件,导入成功,不再报错。如图4

再次导入 SQL 文件,导入成功,不再报错。

图4

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/250670.html

(0)
上一篇 2022年4月30日
下一篇 2022年4月30日

相关推荐

发表回复

登录后才能评论