I get this error:
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->__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
I've tried using localhost buy that doesn't work as i'm using a web hosting provider and their MySQL server is external.
This is my code for accessing the db:
$dbHost = '...';
$db = '...';
$dbUser = '...';
$dbPass = '...';
$db = new PDO("mysql:host=$dbHost;dbname=$db;charset=utf8", $dbUser, $dbPass);
('...' is censored info)