title: Uncaught exception 'PDOException' - Host 'xxx' is not allowed to connect to this MySQL server
body: <p>I get this error:</p>
  
  <pre><code>Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1130] Host 'xxx.xxx.xxx.xxx' is not allowed to connect to this MySQL server' in /home/.../public_html/php/default.php:10 Stack trace: #0 /home/.../public_html/php/default.php(10): PDO-&gt;__construct('mysql:host=...', '...', '...') #1 /home/.../public_html/php/login-status.php(8): getDB() #2 {main} thrown in /home/.../public_html/php/default.php on line 10
  </code></pre>
  
  <p>I've tried using localhost buy that doesn't work as i'm using a web hosting provider and their MySQL server is external.</p>
  
  <p>This is my code for accessing the db:</p>
  
  <pre><code>$dbHost = '...';
  $db = '...';
  $dbUser = '...';
  $dbPass = '...';
  
  $db = new PDO("mysql:host=$dbHost;dbname=$db;charset=utf8", $dbUser, $dbPass);
  </code></pre>
  
  <p>('...' is censored info)</p>