title: How to fix a Laravel 8 SQLSTATE[HY000] [2002] Operation timed out sessions error
body: <p><strong>PHP:</strong> 8.1.1<br />
  <strong>Laravel:</strong> 8.82<br />
  <strong>Nova:</strong> 3.31<br />
  <strong>MySQL:</strong> Serverless Aurora Mysql 5.7</p>
  <p>4-days ago, randomly and seemingly not linked to any specific update we started receiving the following errors in Sentry. Around 7 per hour, a small amount of our traffic and intermittent. It's coming from various routes.</p>
  <pre><code>SQLSTATE[HY000] [2002] Operation timed out (SQL: select * from `sessions` where `id` = XXXXXX9vd29o1pP3HMDRlxfGk4z1nhQfnRXXXXXX limit 1)
  
  /nova/src/Http/Middleware/ServeNova.php in Laravel\Nova\Http\Middleware\ServeNova::handle at line 24
  </code></pre>
  <p>2-weeks ago we updated from Laravel 7 to 8.</p>
  <p>As extra information and insight, if I run the following query directly on our MySQL server I get the following response:</p>
  <pre><code>select * from `sessions` where `id` = XXXXXX9vd29o1pP3HMDRlxfGk4z1nhQfnRXXXXXX limit 1
  
  1054 - Unknown column 'XXXXXX9vd29o1pP3HMDRlxfGk4z1nhQfnRXXXXXX' in 'where clause'
  </code></pre>
  <p>This could be related, whether it's that Sentry displays the error this way or Laravel is missing the quotes around the ID and this is being reported as an 'Operation timed out' error. As a precaution I've changed the name of the session Cookie, hoping to clear any issues with strings. But this hasn't worked.</p>
  <p>Any ideas or where to start debugging this would be appreciated.</p>