Error Code: 2013. Lost connection to MySQL server during query 30.002 sec
There are a lot of issues with the same topic as mine but my content and issue seems to be different. In my workbench, i run the code
`select(msgid) from `table`.log where
id = 'example' and status = 'active' and month(created_at) = 12
and year(created_at) = 2018 limit 0,10;`
The above code works fine but when i run the code b
`select(msgid), count(msgid) from `table`.log where
id = 'example' and status = 'active' and month(created_at) = 12
and year(created_at) = 2018 limit 0,10;`
i get the error
>
Error Code: 2013. Lost connection to MySQL server during query 30.002 sec
Why could this be happening in my workbench ?
PS: New to workbench and mysql
php mysql mysql-workbench
add a comment |
There are a lot of issues with the same topic as mine but my content and issue seems to be different. In my workbench, i run the code
`select(msgid) from `table`.log where
id = 'example' and status = 'active' and month(created_at) = 12
and year(created_at) = 2018 limit 0,10;`
The above code works fine but when i run the code b
`select(msgid), count(msgid) from `table`.log where
id = 'example' and status = 'active' and month(created_at) = 12
and year(created_at) = 2018 limit 0,10;`
i get the error
>
Error Code: 2013. Lost connection to MySQL server during query 30.002 sec
Why could this be happening in my workbench ?
PS: New to workbench and mysql
php mysql mysql-workbench
2
Why is your query so slow? You might want to focus on making it faster instead.
– Salman A
Jan 2 at 18:14
add a comment |
There are a lot of issues with the same topic as mine but my content and issue seems to be different. In my workbench, i run the code
`select(msgid) from `table`.log where
id = 'example' and status = 'active' and month(created_at) = 12
and year(created_at) = 2018 limit 0,10;`
The above code works fine but when i run the code b
`select(msgid), count(msgid) from `table`.log where
id = 'example' and status = 'active' and month(created_at) = 12
and year(created_at) = 2018 limit 0,10;`
i get the error
>
Error Code: 2013. Lost connection to MySQL server during query 30.002 sec
Why could this be happening in my workbench ?
PS: New to workbench and mysql
php mysql mysql-workbench
There are a lot of issues with the same topic as mine but my content and issue seems to be different. In my workbench, i run the code
`select(msgid) from `table`.log where
id = 'example' and status = 'active' and month(created_at) = 12
and year(created_at) = 2018 limit 0,10;`
The above code works fine but when i run the code b
`select(msgid), count(msgid) from `table`.log where
id = 'example' and status = 'active' and month(created_at) = 12
and year(created_at) = 2018 limit 0,10;`
i get the error
>
Error Code: 2013. Lost connection to MySQL server during query 30.002 sec
Why could this be happening in my workbench ?
PS: New to workbench and mysql
php mysql mysql-workbench
php mysql mysql-workbench
asked Jan 2 at 18:02


CodeNewbieCodeNewbie
216
216
2
Why is your query so slow? You might want to focus on making it faster instead.
– Salman A
Jan 2 at 18:14
add a comment |
2
Why is your query so slow? You might want to focus on making it faster instead.
– Salman A
Jan 2 at 18:14
2
2
Why is your query so slow? You might want to focus on making it faster instead.
– Salman A
Jan 2 at 18:14
Why is your query so slow? You might want to focus on making it faster instead.
– Salman A
Jan 2 at 18:14
add a comment |
3 Answers
3
active
oldest
votes
You should try to increase DBMS connection read time out .
Go to Workbench Edit → Preferences → SQL Editor → DBMS connections read time out : increase this to 6000
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
can you send upload a screenshot of the menu you are getting. also what's inside 'sql execution'
– Sourabh Swarnkar
Jan 2 at 18:13
add a comment |
You can change timeout from :
Edit → Preferences → SQL Editor → DBMS connection read time out (in seconds): 600
Changed it to a greater value than your current.
**UPDATE
you can set read timeout also by:
SET @@local.net_read_timeout=360;
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
What version of workbench you have? check it and comment here, and you can execute query to do that check my updated answer
– Tarreq
Jan 2 at 18:11
add a comment |
Here's a screenshot of the preferences from MySQL Workbench 8.0.13. I've put arrows indicating where you should select "SQL Editor" and then where you find the "DBMS connection read timeout interval" field.
I agree with the comment from @SalmanA, you should optimize your query so it's not so slow.
In particular, you should use indexes to help the query narrow down the rows to report. But you can't do that when you use functions like month(created_at)
and year(created_at)
. Presuming you have an index on created_at
, you need to put that column by itself on the left side of comparison operators:
... AND created_at >= '2018-12-01' AND created_at < '2019-01-01'
The best index for this query would be a compound index:
ALTER TABLE log ADD INDEX (id, status, created_at, msg_id);
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011056%2ferror-code-2013-lost-connection-to-mysql-server-during-query-30-002-sec%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should try to increase DBMS connection read time out .
Go to Workbench Edit → Preferences → SQL Editor → DBMS connections read time out : increase this to 6000
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
can you send upload a screenshot of the menu you are getting. also what's inside 'sql execution'
– Sourabh Swarnkar
Jan 2 at 18:13
add a comment |
You should try to increase DBMS connection read time out .
Go to Workbench Edit → Preferences → SQL Editor → DBMS connections read time out : increase this to 6000
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
can you send upload a screenshot of the menu you are getting. also what's inside 'sql execution'
– Sourabh Swarnkar
Jan 2 at 18:13
add a comment |
You should try to increase DBMS connection read time out .
Go to Workbench Edit → Preferences → SQL Editor → DBMS connections read time out : increase this to 6000
You should try to increase DBMS connection read time out .
Go to Workbench Edit → Preferences → SQL Editor → DBMS connections read time out : increase this to 6000
answered Jan 2 at 18:05
Sourabh SwarnkarSourabh Swarnkar
58113
58113
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
can you send upload a screenshot of the menu you are getting. also what's inside 'sql execution'
– Sourabh Swarnkar
Jan 2 at 18:13
add a comment |
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
can you send upload a screenshot of the menu you are getting. also what's inside 'sql execution'
– Sourabh Swarnkar
Jan 2 at 18:13
there is no DBMS connection read time out (in seconds) for mine..all i have is
query editor
, object editor
, 'sql execution'– CodeNewbie
Jan 2 at 18:10
there is no DBMS connection read time out (in seconds) for mine..all i have is
query editor
, object editor
, 'sql execution'– CodeNewbie
Jan 2 at 18:10
can you send upload a screenshot of the menu you are getting. also what's inside 'sql execution'
– Sourabh Swarnkar
Jan 2 at 18:13
can you send upload a screenshot of the menu you are getting. also what's inside 'sql execution'
– Sourabh Swarnkar
Jan 2 at 18:13
add a comment |
You can change timeout from :
Edit → Preferences → SQL Editor → DBMS connection read time out (in seconds): 600
Changed it to a greater value than your current.
**UPDATE
you can set read timeout also by:
SET @@local.net_read_timeout=360;
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
What version of workbench you have? check it and comment here, and you can execute query to do that check my updated answer
– Tarreq
Jan 2 at 18:11
add a comment |
You can change timeout from :
Edit → Preferences → SQL Editor → DBMS connection read time out (in seconds): 600
Changed it to a greater value than your current.
**UPDATE
you can set read timeout also by:
SET @@local.net_read_timeout=360;
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
What version of workbench you have? check it and comment here, and you can execute query to do that check my updated answer
– Tarreq
Jan 2 at 18:11
add a comment |
You can change timeout from :
Edit → Preferences → SQL Editor → DBMS connection read time out (in seconds): 600
Changed it to a greater value than your current.
**UPDATE
you can set read timeout also by:
SET @@local.net_read_timeout=360;
You can change timeout from :
Edit → Preferences → SQL Editor → DBMS connection read time out (in seconds): 600
Changed it to a greater value than your current.
**UPDATE
you can set read timeout also by:
SET @@local.net_read_timeout=360;
edited Jan 2 at 18:14
answered Jan 2 at 18:07


TarreqTarreq
603312
603312
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
What version of workbench you have? check it and comment here, and you can execute query to do that check my updated answer
– Tarreq
Jan 2 at 18:11
add a comment |
there is no DBMS connection read time out (in seconds) for mine..all i have isquery editor
,object editor
, 'sql execution'
– CodeNewbie
Jan 2 at 18:10
What version of workbench you have? check it and comment here, and you can execute query to do that check my updated answer
– Tarreq
Jan 2 at 18:11
there is no DBMS connection read time out (in seconds) for mine..all i have is
query editor
, object editor
, 'sql execution'– CodeNewbie
Jan 2 at 18:10
there is no DBMS connection read time out (in seconds) for mine..all i have is
query editor
, object editor
, 'sql execution'– CodeNewbie
Jan 2 at 18:10
What version of workbench you have? check it and comment here, and you can execute query to do that check my updated answer
– Tarreq
Jan 2 at 18:11
What version of workbench you have? check it and comment here, and you can execute query to do that check my updated answer
– Tarreq
Jan 2 at 18:11
add a comment |
Here's a screenshot of the preferences from MySQL Workbench 8.0.13. I've put arrows indicating where you should select "SQL Editor" and then where you find the "DBMS connection read timeout interval" field.
I agree with the comment from @SalmanA, you should optimize your query so it's not so slow.
In particular, you should use indexes to help the query narrow down the rows to report. But you can't do that when you use functions like month(created_at)
and year(created_at)
. Presuming you have an index on created_at
, you need to put that column by itself on the left side of comparison operators:
... AND created_at >= '2018-12-01' AND created_at < '2019-01-01'
The best index for this query would be a compound index:
ALTER TABLE log ADD INDEX (id, status, created_at, msg_id);
add a comment |
Here's a screenshot of the preferences from MySQL Workbench 8.0.13. I've put arrows indicating where you should select "SQL Editor" and then where you find the "DBMS connection read timeout interval" field.
I agree with the comment from @SalmanA, you should optimize your query so it's not so slow.
In particular, you should use indexes to help the query narrow down the rows to report. But you can't do that when you use functions like month(created_at)
and year(created_at)
. Presuming you have an index on created_at
, you need to put that column by itself on the left side of comparison operators:
... AND created_at >= '2018-12-01' AND created_at < '2019-01-01'
The best index for this query would be a compound index:
ALTER TABLE log ADD INDEX (id, status, created_at, msg_id);
add a comment |
Here's a screenshot of the preferences from MySQL Workbench 8.0.13. I've put arrows indicating where you should select "SQL Editor" and then where you find the "DBMS connection read timeout interval" field.
I agree with the comment from @SalmanA, you should optimize your query so it's not so slow.
In particular, you should use indexes to help the query narrow down the rows to report. But you can't do that when you use functions like month(created_at)
and year(created_at)
. Presuming you have an index on created_at
, you need to put that column by itself on the left side of comparison operators:
... AND created_at >= '2018-12-01' AND created_at < '2019-01-01'
The best index for this query would be a compound index:
ALTER TABLE log ADD INDEX (id, status, created_at, msg_id);
Here's a screenshot of the preferences from MySQL Workbench 8.0.13. I've put arrows indicating where you should select "SQL Editor" and then where you find the "DBMS connection read timeout interval" field.
I agree with the comment from @SalmanA, you should optimize your query so it's not so slow.
In particular, you should use indexes to help the query narrow down the rows to report. But you can't do that when you use functions like month(created_at)
and year(created_at)
. Presuming you have an index on created_at
, you need to put that column by itself on the left side of comparison operators:
... AND created_at >= '2018-12-01' AND created_at < '2019-01-01'
The best index for this query would be a compound index:
ALTER TABLE log ADD INDEX (id, status, created_at, msg_id);
edited Jan 2 at 18:21
answered Jan 2 at 18:15


Bill KarwinBill Karwin
384k64520678
384k64520678
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011056%2ferror-code-2013-lost-connection-to-mysql-server-during-query-30-002-sec%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Why is your query so slow? You might want to focus on making it faster instead.
– Salman A
Jan 2 at 18:14