Error Code: 2013. Lost connection to MySQL server

2019-01-01 06:35发布

I got the Error Code: 2013. Lost connection to MySQL server during query error when I tried to add an index to a table using MySQL Workbench. I noticed also that it appears whenever I run long query.

Is there away to increase the timeout value?

26条回答
步步皆殇っ
2楼-- · 2019-01-01 07:07

I had the same problem - but for me the solution was a DB user with too strict permissions. I had to allow the Execute ability on the mysql table. After allowing that I had no dropping connections anymore

查看更多
几人难应
3楼-- · 2019-01-01 07:08

Go to Workbench Edit → Preferences → SQL Editor → DBMS connections read time out : Up to 3000. The error no longer occurred.

查看更多
深知你不懂我心
4楼-- · 2019-01-01 07:09

Just perform a MySQL upgrade that will re-build innoDB engine along with rebuilding of many tables required for proper functioning of MySQL such as performance_schema, information_schema, etc.

Issue the below command from your shell:

sudo mysql_upgrade -u root -p
查看更多
刘海飞了
5楼-- · 2019-01-01 07:11

Check if the indexes are in place first.

SELECT *
FROM INFORMATION_SCHEMA.STATISTICS
WHERE TABLE_SCHEMA = '<schema>'
查看更多
不流泪的眼
6楼-- · 2019-01-01 07:13
SET @@local.net_read_timeout=360;

Warning: The following will not work when you are applying it in remote connection:

SET @@global.net_read_timeout=360;
查看更多
人气声优
7楼-- · 2019-01-01 07:13

I got the same issue when loading a .csv file. Converted the file to .sql.

Using below command I manage to work around this issue.

mysql -u <user> -p -D <DB name> < file.sql

Hope this would help.

查看更多
登录 后发表回答