简体   繁体   English

无法连接到 MySQL:用户 'u201944136_root'@'localhost' 的访问被拒绝(使用密码:是)

[英]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.

相关问题 无法连接到 MySQL:用户 'root'@'localhost' 的访问被拒绝(使用密码:是) - Failed to connect to MySQL: Access denied for user 'root'@'localhost' (using password: YES) 警告:mysql_connect():用户'root'@'localhost'拒绝访问(使用密码:YES) - Warning: mysql_connect(): Access denied for user 'root'@'localhost' (using password: YES) 用户 'root'@'localhost' 的访问被拒绝(使用密码:YES)' - Access denied for user 'root'@'localhost' (using password: YES)' 使用MAMP拒绝用户'root'@'localhost'的访问(使用密码:是) - Access denied for user 'root'@'localhost' (using password: YES) using MAMP 用户'root'@'localhost'的访问被拒绝(使用密码:是) - Access denied for user 'root'@'localhost' (using password: YES) #1045-用户'root'@'localhost'的访问被拒绝(使用密码:是) - #1045 - Access denied for user 'root'@'localhost' (using password: YES) laravel 5用户“ root” @“ localhost”的访问被拒绝(使用密码:是) - laravel 5 Access denied for user 'root'@' localhost' (using password: YES) 当我尝试远程访问mysql时,拒绝用户'root'@'localhost'的访问(使用密码:是) - Access denied for user 'root'@'localhost' (using password: YES) when i try accessing mysql remotely 如何修复用户'root'@'localhost'的MySql异常访问被拒绝(使用密码:是) - How to fix MySql Exception Access denied for user 'root'@'localhost' (using password: YES) 连接失败:用户 ''username'@'localhost' 访问被拒绝(使用密码:YES) - Connection failed: Access denied for user ''username'@'localhost' (using password: YES)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM