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

后端 未结 29 1801
深忆病人
深忆病人 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:33

    New versions of MySQL WorkBench have an option to change specific timeouts.

    For me it was under Edit → Preferences → SQL Editor → DBMS connection read time out (in seconds): 600

    Changed the value to 6000.

    Also unchecked limit rows as putting a limit in every time I want to search the whole data set gets tiresome.

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

    There are three likely causes for this error message

    1. Usually it indicates network connectivity trouble and you should check the condition of your network if this error occurs frequently
    2. Sometimes the “during query” form happens when millions of rows are being sent as part of one or more queries.
    3. More rarely, it can happen when the client is attempting the initial connection to the server

    For more detail read >>

    Cause 2 :

    SET GLOBAL interactive_timeout=60;
    

    from its default of 30 seconds to 60 seconds or longer

    Cause 3 :

    SET GLOBAL connect_timeout=60;
    
    0 讨论(0)
  • 2020-11-22 16:34

    Turns out our firewall rule was blocking my connection to MYSQL. After the firewall policy is lifted to allow the connection i was able to import the schema successfully.

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

    If you are using SQL Work Bench, you can try using Indexing, by adding an index to your tables, to add an index, click on the wrench(spanner) symbol on the table, it should open up the setup for the table, below, click on the index view, type an index name and set the type to index, In the index columns, select the primary column in your table.

    Do the same step for other primary keys on other tables.

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

    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
    
    0 讨论(0)
  • 2020-11-22 16:37

    This usually means that you have "incompatibilities with the current version of MySQL Server", see mysql_upgrade. I ran into this same issue and simply had to run:

    mysql_upgrade --password The documentation states that, "mysql_upgrade should be executed each time you upgrade MySQL".

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