<p><a href="http://www.yiiframework.com/doc/api/1.1/CDbException" rel="nofollow">CDbException</a> is the exception that <a href="http://www.yiiframework.com/" rel="nofollow">Yii</a> will throw when something has gone wrong with a database operation.</p>

<p>Here's the only important part of the error message:</p>

<pre><code>SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query.
</code></pre>

<p>Unfortunately that error can occur for any one of <a href="https://www.google.com/search?q=SQLSTATE%5BHY000%5D%3A%20General%20error%3A%202013%20Lost%20connection%20to%20MySQL%20server%20during%20query" rel="nofollow">3,210 different reasons</a> including network connection errors, misconfigured PDO, MySQL and/or PHP, etc.  It's going to be difficult to track down especially if it's only occurring sporadically.</p>

CC BY-SA 3.0
2014-07-16T18:00:57.897Z
2014-07-16T18:00:57.897Z
Brad Bell
<p>Looks like it is failing in local development on a Mac. My experience with native MySQL on OS X 10.9.3 is that the MySQL server just stops working once every few weeks, and I have to restart it. Since it's only occasional and I don't use it for anything really critical, I just live with the restarts.</p>

CC BY-SA 3.0
2014-07-16T07:11:11.310Z
2014-07-16T07:11:11.310Z
Marion Newlevant
<p>This just happened, but just one time. Any idea why?</p>
<blockquote>
<p>CDbException</p>
<p>CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query. The SQL statement executed was: SELECT <code>id</code>, <code>groupId</code>, <code>name</code>, <code>handle</code>, <code>context</code>, <code>instructions</code>, <code>translatable</code>, <code>type</code>, <code>settings</code> FROM <code>craft_fields</code> WHERE context = :context ORDER BY <code>name</code>. Bound with :context='global' (/Users/johndoe/Desktop/Projects/websitetest/craft/app/framework/db/CDbCommand.php:543)</p>
<p>0 /Users/johndoe/Desktop/Projects/websitetest/craft/app/framework/db/CDbCommand.php(396): CDbCommand-&gt;queryInternal('fetchAll', Array, Array)</p>
<p>... (large, not relevant stack trace)</p>
<p>30 {main}</p>
</blockquote>

<database>
CDbException: What does this mean?
# CDbException: What does this mean?

(Asked by: username_0 on 2014-07-16)

This just happened, but just one time. Any idea why?

> CDbException
>
> CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query. The SQL statement executed was: SELECT `id`, `groupId`, `name`, `handle`, `context`, `instructions`, `translatable`, `type`, `settings` FROM `craft_fields` WHERE context = :context ORDER BY `name`. Bound with :context='global' (/Users/johndoe/Desktop/Projects/websitetest/craft/app/framework/db/CDbCommand.php:543)
>
> 0 /Users/johndoe/Desktop/Projects/websitetest/craft/app/framework/db/CDbCommand.php(396): CDbCommand->queryInternal('fetchAll', Array, Array)
>
> ... (large, not relevant stack trace)
>
> 30 {main}

**Tags:** database


---

## 2 answers

### Answer by username_1 on 2014-07-16. Score: 2

CDbException is the exception that Yii will throw when something has gone wrong with a database operation.
Here's the only important part of the error message:
SQLSTATE[HY000]: General error: 2013 Lost connection to MySQL server during query.

Unfortunately that error can occur for any one of 3,210 different reasons including network connection errors, misconfigured PDO, MySQL and/or PHP, etc.  It's going to be difficult to track down especially if it's only occurring sporadically.


---

### Answer by username_2 on 2014-07-16. Score: 2

Looks like it is failing in local development on a Mac. My experience with native MySQL on OS X 10.9.3 is that the MySQL server just stops working once every few weeks, and I have to restart it. Since it's only occasional and I don't use it for anything really critical, I just live with the restarts.


---

