<p>Please try to increase the values for</p>
<ul>
<li>wait_timeout (as Brad pointed out above)</li>
<li>net_write_timeout</li>
<li>net_read_timeout</li>
</ul>
<p>Let me know if this helped.</p>

CC BY-SA 4.0
2023-02-28T07:28:31.670Z
2023-02-28T07:28:31.670Z
Matthias Redl-Mann
<p><code>max_allowed_packet</code> isn't the only thing that can cause a &quot;MySQL server has gone away&quot; error.</p>
<p><code>wait_timeout</code> is another common one but, unfortunately, it's a generic error that MySQL throws for many things.</p>
<p>The MySQL docs have a whole page dedicated to those things worth checking out: <a href="https://dev.mysql.com/doc/refman/8.0/en/gone-away.html" rel="nofollow noreferrer">https://dev.mysql.com/doc/refman/8.0/en/gone-away.html</a></p>

CC BY-SA 4.0
2022-06-02T04:36:22.943Z
2022-06-02T04:36:22.943Z
Brad Bell
<p>After adding a second block type to an existing matrix field, we started receiving a &quot;General error: 2006 MySQL server has gone away&quot; error when additional content was saved to the new block type (screenshot attached). This error was shown in the CP and on the front-end. I was also unable to export the database via Sequel Pro.</p>
<p>This error only occurred on production- for some reason development and staging were fine.</p>
<p>I have since fixed production by restoring an earlier version of the database. We're now able to add content to the new matrix block type.</p>
<p>In trying to figure out what caused this error, I came upon the <code>max_allowed packet</code> setting.</p>
<p><a href="https://dev.mysql.com/doc/refman/8.0/en/packet-too-large.html" rel="nofollow noreferrer">The MySQL docs</a> say:</p>
<blockquote>
<p>Both the client and the server have their own max_allowed_packet variable, so if you want to handle big packets, you must increase this variable both in the client and in the server.</p>
</blockquote>
<p>According to <a href="https://dba.stackexchange.com/a/45106">this SO post</a>, <code>SHOW VARIABLES LIKE 'max_allowed_packet'</code> tells me that the <em>server</em> value is 64mb.</p>
<p>So I have two questions.</p>
<ol>
<li>How do I see the current <em>client</em> value of <code>max_allowed_packet</code> (I understand that the docs say it's 16mb by default).</li>
<li>Is it necessary to adjust the <em>client</em> value in the context of running a Craft site? Or does that only apply if I'm manually using the CLI?</li>
</ol>
<p><a href="https://i.sstatic.net/dPfto.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dPfto.jpg" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2022-08-01T04:37:42.920Z
I'm getting same error. I tried all the way which i can do but problem not solved. Have you found any clue to solve this ?
Vinod Patidar
CC BY-SA 4.0
2022-09-23T15:50:49.090Z
@VinodPatidar Sorry, I think I was only able to get past this by restoring a previous database backup :(
plaintxt
CC BY-SA 4.0
2024-10-31T14:40:57.153Z
Did you find the problem? After migration to craft 5 I experience the same problem
KSPR
<craft3><mysql>
MySQL server has gone away / max_allowed_packet
# MySQL server has gone away / max_allowed_packet

(Asked by: username_0 on 2022-06-01)

After adding a second block type to an existing matrix field, we started receiving a "General error: 2006 MySQL server has gone away" error when additional content was saved to the new block type (screenshot attached). This error was shown in the CP and on the front-end. I was also unable to export the database via Sequel Pro.

This error only occurred on production- for some reason development and staging were fine.

I have since fixed production by restoring an earlier version of the database. We're now able to add content to the new matrix block type.

In trying to figure out what caused this error, I came upon the `max_allowed packet` setting.

[The MySQL docs](https://dev.mysql.com/doc/refman/8.0/en/packet-too-large.html) say:

> Both the client and the server have their own max\_allowed\_packet variable, so if you want to handle big packets, you must increase this variable both in the client and in the server.

According to [this SO post](https://dba.stackexchange.com/a/45106), `SHOW VARIABLES LIKE 'max_allowed_packet'` tells me that the *server* value is 64mb.

So I have two questions.

1. How do I see the current *client* value of `max_allowed_packet` (I understand that the docs say it's 16mb by default).
2. Is it necessary to adjust the *client* value in the context of running a Craft site? Or does that only apply if I'm manually using the CLI?

[![enter image description here](https://i.sstatic.net/dPfto.jpg)](https://i.sstatic.net/dPfto.jpg)

**Tags:** craft3, mysql
> **Comments:**
> **username_1**: I'm getting same error. I tried all the way which i can do but problem not solved. Have you found any clue to solve this ?  
> **username_0**: @VinodPatidar Sorry, I think I was only able to get past this by restoring a previous database backup :(  
> **username_2**: Did you find the problem? After migration to craft 5 I experience the same problem  

---

## 2 answers

### Answer by username_3 on 2023-02-28. Score: 1

Please try to increase the values for

* wait\_timeout (as Brad pointed out above)
* net\_write\_timeout
* net\_read\_timeout

Let me know if this helped.


---

### Answer by username_4 on 2022-06-02. Score: 0

`max_allowed_packet` isn't the only thing that can cause a "MySQL server has gone away" error.

`wait_timeout` is another common one but, unfortunately, it's a generic error that MySQL throws for many things.

The MySQL docs have a whole page dedicated to those things worth checking out: <https://dev.mysql.com/doc/refman/8.0/en/gone-away.html>


---

