我得到了错误代码:2013。当我试图使用MySQL工作台向表添加索引时,在查询错误期间失去了与MySQL服务器的连接。 我还注意到,每当我运行长查询时,它就会出现。

是否有增加超时值的方法?


当前回答

原来我们的防火墙规则阻止了我连接MYSQL。在解除防火墙策略以允许连接后,我能够成功地导入架构。

其他回答

我在运行一个存储过程时遇到了这个问题——它正在数据库中的一个表中创建大量的行。 在超过30秒后,我就看到了这个错误。

我尝试了其他答案中的所有建议。我确信其中有一些帮助,然而,真正让我有用的是从Workbench切换到SequelPro。

我猜这是我在Workbench中没有发现的某个客户端连接。 也许这也能帮助到其他人?

我知道它很老,但在mac上

1. Control-click your connection and choose Connection Properties.
2. Under Advanced tab, set the Socket Timeout (sec) to a larger value.

使用MySql Server 8.0.28社区版,在我的模式中创建了100多个表。MySql服务器不能正常工作,多次崩溃。我发现了问题和解决方案。

我写了“select count(*) from table1..”Table100”查询并在.sql文件中运行。

问题1:MySql服务器设置utf8mb4和我的表创建utf8。

解决方案1:必须设置表和列,或者使用utf8mb4重新创建。

问题2:需要重新配置back_log参数。

解决方案2:set back_log=50+(coonectioncount/5)

问题3:wait_timeout参数需要重新配置。

解决方案3:您必须将其设置为180+(您可以尝试较大的值)

这个行动解决了我的问题。

先建立联系 Mysql——host=host.com——port=3306 -u username -p 然后选择你的db use dbname C:\dumpfile.sql 做完之后\q

如果您在恢复一个大转储文件期间遇到这个问题,并且可以排除与网络有关的问题(例如在本地主机上执行),那么我的解决方案可能会有帮助。

我的mysqldump至少有一个INSERT太大,mysql无法计算。你可以通过输入show变量"net_buffer_length";在你的mysql-cli中。 你有三种可能:

increase net_buffer_length inside mysql -> this would need a server restart create dump with --skip-extended-insert, per insert one line is used -> although these dumps are much nicer to read this is not suitable for big dumps > 1GB because it tends to be very slow create dump with extended inserts (which is the default) but limit the net-buffer_length e.g. with --net-buffer_length NR_OF_BYTES where NR_OF_BYTES is smaller than the server's net_buffer_length -> I think this is the best solution, although slower no server restart is needed.

我使用以下mysqldump命令: mysqldump——skip-comments——set-charset——default-character-set=utf8——single-transaction——net-buffer_length 4096 DBX >转储文件