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

后端 未结 29 1887
深忆病人
深忆病人 2020-11-22 16:22

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 als

相关标签:
29条回答
  • 2020-11-22 16:43

    Try please to uncheck limit rows in in Edit → Preferences →SQL Queries

    because You should set the 'interactive_timeout' and 'wait_timeout' properties in the mysql config file to the values you need.

    0 讨论(0)
  • 2020-11-22 16:43

    Change "read time out" time in Edit->Preferences->SQL editor->MySQL session

    0 讨论(0)
  • 2020-11-22 16:44

    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

    0 讨论(0)
  • 2020-11-22 16:48

    Thanks!It's worked. But with the mysqldb updates the configure has became:

    max_allowed_packet

    net_write_timeout

    net_read_timeout

    mysql doc

    0 讨论(0)
  • 2020-11-22 16:48

    If you experience this problem during the restore of a big dump-file and can rule out the problem that it has anything to do with network (e.g. execution on localhost) than my solution could be helpful.

    My mysqldump held at least one INSERT that was too big for mysql to compute. You can view this variable by typing show variables like "net_buffer_length"; inside your mysql-cli. You have three possibilities:

    • 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.

    I used following mysqldump command: mysqldump --skip-comments --set-charset --default-character-set=utf8 --single-transaction --net-buffer_length 4096 DBX > dumpfile

    0 讨论(0)
提交回复
热议问题