# Error code: 2013. Lost connection to MySQL server during query

**URL:** <https://forum.inductiveautomation.com/t/error-code-2013-lost-connection-to-mysql-server-during-query/55199>\
**Category:** Ignition Exchange\
**Tags:** ignition80\
**Created:** [January 20, 2022, 9:15am UTC](https://forum.inductiveautomation.com/t/error-code-2013-lost-connection-to-mysql-server-during-query/55199 "2022-01-20T09:15:31Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thaha\_Mutheth](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@Thaha\_Mutheth](https://forum.inductiveautomation.com/u/Thaha_Mutheth)\
**Post date:** [January 20, 2022, 9:15am UTC](https://forum.inductiveautomation.com/t/error-code-2013-lost-connection-to-mysql-server-during-query/55199/1 "2022-01-20T09:15:31Z")

</div>

Hi all,  
I have tried to restore IA Demo from Ignition exchange. As a part of the instructions, firstly I set up SQL installation and tried to import “all\_databases.sql” file. While executing the query, it always lost the connection when accessing creating ‘Documents’.

---

<div class="post-metadata">

**Author:** ![rzakskorn](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@rzakskorn](https://forum.inductiveautomation.com/u/rzakskorn)\
**Post date:** [January 20, 2022, 5:17pm UTC](https://forum.inductiveautomation.com/t/error-code-2013-lost-connection-to-mysql-server-during-query/55199/2 "2022-01-20T17:17:08Z")

</div>

Hello @Thaha_Mutheth! The all\_databases.sql file is a fairly large self-contained file so the **wait\_timeout** and **max\_allowed\_packet** parameters need to be increased in order to successfully import.

I suggest running these two lines first before importing the all\_databases.sql file:

`SET GLOBAL max_allowed_packet=1073741824;`  
`SET GLOBAL wait_timeout = 300;`

---

<div class="post-metadata">

**Author:** ![Thaha\_Mutheth](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@Thaha\_Mutheth](https://forum.inductiveautomation.com/u/Thaha_Mutheth)\
**Post date:** [January 20, 2022, 6:21pm UTC](https://forum.inductiveautomation.com/t/error-code-2013-lost-connection-to-mysql-server-during-query/55199/3 "2022-01-20T18:21:32Z")

</div>

> [@rzakskorn](#):
>
> `SET GLOBAL max_allowed_packet=1073741824;`  
> `SET GLOBAL wait_timeout = 300;`

I have already tried this. Still the issue I am facing. Something interrupted the query execution while the execution in between creating "document" table under IADemo . I am using mysql workbench 8.0

---

<div class="post-metadata">

**Author:** ![rzakskorn](https://avatars.discourse-cdn.com/v4/letter/r/dec6dc/32.png) [@rzakskorn](https://forum.inductiveautomation.com/u/rzakskorn)\
**Post date:** [January 20, 2022, 7:22pm UTC](https://forum.inductiveautomation.com/t/error-code-2013-lost-connection-to-mysql-server-during-query/55199/4 "2022-01-20T19:22:50Z")

</div>

First, let’s make sure that the process isn’t running on the client even though the connection timed out. You can check this out by going to `Server > Client Connections` on MySQL Workbench and make sure there are no processes/queries still running that pertain to the import.

Next, I would recommend increasing the timeout intervals for your MySQL Session. That can be found on MySQL Workbench under `Edit > Preferences... > SQL Editor > MySQL Sessions` and set the timeout intervals for each section to 600 seconds.

It is also possible that you are running into a timeout after 5 minutes still, if so, I would suggest increasing the timeout to 10 minutes by executing these lines in MySQL Workbench:

`SET GLOBAL max_allowed_packet=1073741824;`  
`SET GLOBAL wait_timeout = 600;`  
`SET GLOBAL net_read_timeout = 600;`  
`SET GLOBAL connect_timeout = 600;`

After executing the above lines, try to import the all\_database.sql file and monitor the Client Connections page while the file is being imported. If we can determine that Workbench is losing it’s connection to your database, we may need to do a command line restore.

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [January 21, 2022, 1:51am UTC](https://forum.inductiveautomation.com/t/error-code-2013-lost-connection-to-mysql-server-during-query/55199/5 "2022-01-21T01:51:13Z")

</div>

It’s also worth noting that we’re working on reducing the size of those files. This normally happens when you’re installing locally without a fast database server to process the large amounts of data in that file. Our update will be simply to reduce the size of the examples there to make them quicker to import, which should bypass the problem entirely.

---

<div class="post-metadata">

**Author:** ![Thaha\_Mutheth](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@Thaha\_Mutheth](https://forum.inductiveautomation.com/u/Thaha_Mutheth)\
**Post date:** [January 21, 2022, 4:28pm UTC](https://forum.inductiveautomation.com/t/error-code-2013-lost-connection-to-mysql-server-during-query/55199/6 "2022-01-21T16:28:07Z")

</div>

I hope this this is the reason. I was trying to install locally. It would be good if you can split the file for different database. I tried locally, but ended up with my machine in freezing stage.

---

<div class="post-metadata">

**Author:** ![Thaha\_Mutheth](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@Thaha\_Mutheth](https://forum.inductiveautomation.com/u/Thaha_Mutheth)\
**Post date:** [January 22, 2022, 8:28am UTC](https://forum.inductiveautomation.com/t/error-code-2013-lost-connection-to-mysql-server-during-query/55199/7 "2022-01-22T08:28:08Z")

</div>

It works perfectly. Thanks
