mysql 工作台“与 mysql 服务器的连接丢失”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29083330/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 13:23:55  来源:igfitidea点击:

mysql workbench "Lost connection to mysql server"

mysqltimeoutgroup-concat

提问by Andisheh Keikha

First I need to indicate that I ran the sql file for the Wikipedia dump on my machine, and to be able to run that I needed to update many settings regarding the index size available on memory and some other settings. I just want to mention that those large sql queries were run successfully and I didn't have any problem regarding memory or time out.

首先,我需要指出我在我的机器上运行了维基百科转储的 sql 文件,并且为了能够运行,我需要更新许多关于内存中可用索引大小和一些其他设置的设置。我只想提一下,那些大型 sql 查询已成功运行,并且在内存或超时方面没有任何问题。

Now I have a table pagelinks (pl_from, pl_title) that shows the links that appears in each wikipedia page, for example the data can be (1, "title1"), (1,"title2"), (2, "title3"), (2, "title1"). I want to create a table that concat the titles group by pl_from. For that this is my sql query (I am using workbench):

现在我有一个表 pagelinks (pl_from, pl_title) 显示出现在每个维基百科页面中的链接,例如数据可以是 (1, "title1"), (1,"title2"), (2, "title3" ), (2, "title1")。我想创建一个表,通过 pl_from 连接标题组。为此,这是我的 sql 查询(我正在使用工作台):

SET @@group_concat_max_len=150000;
create table concatpagelinks 
(SELECT pl_from, GROUP_CONCAT(pl_title , ' ') as links FROM pagelinks GROUP BY pl_from)

Running this query I got the error : "Lost connection to mysql server during query" and the system asked me again for the password. So I search and found this. Therefore I changed net_read_timeout to 1000 and connect_timeout to 60. It didn't solve the problem, SO I changed the query to :

运行此查询时,我收到错误消息:“在查询过程中失去了与 mysql 服务器的连接”,系统再次要求我输入密码。所以我搜索并找到了这个。因此,我将 net_read_timeout 更改为 1000,将 connect_timeout 更改为 60。它没有解决问题,所以我将查询更改为:

SET @@group_concat_max_len=150000;
create table concatpagelinks 
(SELECT pl_from, GROUP_CONCAT(pl_title , ' ') as links FROM pagelinks GROUP BY pl_from limit 0,1000)

Still the same problem, and the amazing thing is that every time the query is run for 600.495 sec and the error happens.

仍然是同样的问题,令人惊奇的是,每次查询运行 600.495 秒时都会发生错误。

回答by Yuri Malheiros

You can try to change the timeout value on Workbench. Go to: Edit → Preferences → SQL Editor → DBMS connection read time out

您可以尝试在 Workbench 上更改超时值。转到:编辑 → 首选项 → SQL 编辑器 → DBMS 连接读取超时

See this post for more details:

有关更多详细信息,请参阅此帖子:

Error Code: 2013. Lost connection to MySQL server during query

错误代码:2013。在查询过程中失去与 MySQL 服务器的连接

Or try to increase the value in: Edit → Preferences → SQL Editor → DBMS_Connection keep alive interval

或者尝试在:Edit → Preferences → SQL Editor → DBMS_Connection 保持活动间隔中增加值