title: MySQL server has gone away
body: <p>Here my code snippet:</p>
  
  <pre><code>query.next();
  qDebug()&lt;&lt;query.lastError();
  qlonglong res=query.value(0).toLongLong();
  qDebug()&lt;&lt;query.lastError();
  </code></pre>
  
  <p>and the corresponding log I have:</p>
  
  <pre><code>Debug: QSqlError(2006, "QMYSQL: Unable to execute query", "MySQL server has gone away") 
  Warning: QSqlQuery::value: not positioned on a valid record
  Debug: QSqlError(2006, "QMYSQL: Unable to execute query", "MySQL server has gone away")
  </code></pre>
  
  <p>Normally my program works just fine (it works on a server and accepts connections from  clients), but every morning when I tried to connect it, I'm getting messages above. </p>
  
  <p>What can be the problem with MySQL server?</p>