title: Laravel & DigitalOcean - Remote Access to mysql from DigitalOcean Droplet gives this error: SQLSTATE[HY000] [2006] MySQL server has gone away;
body: <p>I've hosted my laravel app on a digitalocean droplet (Ngnix Ubuntu) . Everything from this side is working well.</p>
  <p>I need to test <strong>remote</strong> <strong>access</strong> to mysql.</p>
  <ol>
  <li><p>First, from the Droplet's side, I've granted access to mysql by any
  Ip address by this command: <code>sudo ufw allow 3306</code></p>
  </li>
  <li><p>To test the remote access, I've tried to connect a localhost laravel app to the droplet's mysql database .</p>
  </li>
  </ol>
  <pre><code>DB_HOST= here I've put the Ip address of the droplet.
  DB_PORT=3306
  DB_DATABASE=dbname
  DB_USERNAME=dbuser
  DB_PASSWORD=dbpass
  </code></pre>
  <ol start="3">
  <li>It gives this error :</li>
  </ol>
  <pre><code>    SQLSTATE[HY000] [2006] MySQL server has gone away (SQL: select * from 'users' where 'username' = admin limit 1)
  </code></pre>
  <p>I tried to search a lot.. tried some suggestions.. still no solution.</p>
  <p>EDIT: This is my.cnf file in /etc/mysql ..
  <a href="https://i.stack.imgur.com/g7jos.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g7jos.png" alt="my.cnf" /></a></p>
  <p>Thanks in advance!</p>