How to resolve the "Can not connect to MySQL server on" error? [closed]

-1

Error:

Warning: mysqli_connect(): (HY000/2003): Can't connect to MySQL server on 'mysql.hostinger.com.br' (111 "Connection refused") in /home/u307075603/public_html/db.php on line 8

This error I get.

    
asked by anonymous 01.07.2017 / 16:52

1 answer

1

This is a privilege issue, ie you are not allowed to access this database.

If the server is yours, you can use this command line to grant the privileges:

mysql> CREATE USER 'usuario'@'mysql.hostinger.com.br' IDENTIFIED BY 'senha';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'usuario'@'mysql.hostinger.com.br'
    ->     WITH GRANT OPTION;

If it is not and you have purchased it, you are probably trying to enter the wrong database or with a wrong username.

    
01.07.2017 / 17:09