[英]Failed to connect to MySQL: Access denied for user 'u201944136_root'@'localhost' (using password: YES)
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.
提前致谢。
thanks for helping me.谢谢你帮助我。 it was hosting issue.
这是托管问题。 i mailed to the support system of the hostinger.
我邮寄到托管商的支持系统。 they told me to change my database password and then update the script.
他们告诉我更改我的数据库密码,然后更新脚本。 i follow the instructions and my error was solved.
我按照说明操作,我的错误已解决。 Thank You All.
谢谢你们。
Are you sure that localhost is the right host?您确定 localhost 是正确的主机吗? 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.
我还将转储 mysqli_connect_errno() 值,因为它返回上次连接尝试的错误代码,这将为您提供一个很好的指示问题所在。 and I would check if the user u201944136_root is defined and have permissions against localhost (mysql> SHOW GRANTS FOR 'u201944136_root'@'localhost';)
我会检查用户 u201944136_root 是否已定义并具有对 localhost 的权限(mysql> SHOW GRANTS FOR 'u201944136_root'@'localhost';)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.