How to resolve "Can’t connect to Mysql server on" error?

Asked

Viewed 2,632 times

-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.

  • tend to add the code you are running, thus helps people to better understand the error.

1 answer

1

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

If the server is yours, you can use this command line to secure 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’s not and you bought it, you’re probably trying to enter the wrong database or with a wrong username.

  • I’ll try beauty?

  • is the mysql or host user?

  • Could you show me how the line 8 is?

  • $link = mysqli_connect('mysql.hostinger.com.br', 'user', 'password', 'userhost', 5306);

  • Check your parameters. Where you put 'userhost', is the name of the database.

  • okay I’ll see!!!

  • solved one of the errors, but has another error

  • and you’re saying that you can’t connect to Mysql Server

  • Could you please copy the paste the error, so I understand better?

  • Warning: mysqli_connect(): (HY000/2005): Unknown Mysql server host 'u307075603_zeref' (-5) in /home/u307075603/public_html/db.php on line 8

  • As line 8 is now?

  • $link = mysqli_connect('31.170.167.225', 'user', 'password', 'u307075603_zeref', 5306);

  • Dude, your parameters are filled in correctly. Or it’s a server problem 31.170.167.225 or you’re missing the name of the bank.

  • is the server, but here it is written look there

  • http://prntscr.com/fqf75u

  • ve a print ai and tell me if I have to put mysql.hostinger.com.br

  • Dude, if your domain on Hostinger is the one that’s free, you can give it up you won’t be able to connect...

Show 12 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.