I got stuck at this. i am using hostinger for my website
$server = "localhost";
$user = ""; //Username
$password = ""; //Password
$database = ""; //Database
$connection = mysqli_connect($server,$user,$password,$database);
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
exit();
}
This is my code. i could not find a relevant answer. Thanks in advance.
CodePudding user response:
Are you sure that localhost is the right host? I would also dump the mysqli_connect_errno() value because it returns the error code from the last connection attempt, which will give you a very good indication of where the issue is. and I would check if the user u201944136_root is defined and have permissions against localhost (mysql> SHOW GRANTS FOR 'u201944136_root'@'localhost';)
CodePudding user response:
I think the answer here would be the answer to the question you asked in a different way. This problem in recent versions is usually related to the new authentication plugin.plugin'i ile ilgili.