简体   繁体   English

用户 'user'@'localhost' 的访问被拒绝(使用密码:YES)错误

[英]Access denied for user 'user'@'localhost' (using password: YES) error

I am trying to install my php script on live server but am getting an error.我正在尝试在实时服务器上安装我的 php 脚本,但出现错误。 I have already created a db/user and uploaded sql to my phypmyadmin我已经创建了一个数据库/用户并将 sql 上传到我的 phypmyadmin

Error I am getting is我得到的错误是

Access denied for user 'user'@'localhost' (using password: YES)用户 'user'@'localhost' 的访问被拒绝(使用密码:YES)

It's simply telling you that the username or password is not right, so you can't have an access.它只是告诉您用户名或密码不正确,因此您无法访问。

Please check the password and the name of the user inside your php script, take a look at this.请检查 php 脚本中的密码和用户名,看看这个。

<?php 
$con = mysqli_connect("localhost","my_user","my_password","my_db");

// Check connection
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  exit();
}
?>

You see in your case you need to change these parameters to the ones in your live server. 您会看到在您的情况下,您需要将这些参数更改为实时服务器中的参数。

 $con = mysqli_connect("your_server","your_user","your_password","your_db"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: ". mysqli_connect_error(); exit(); }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用MAMP拒绝用户&#39;root&#39;@&#39;localhost&#39;的访问(使用密码:是) - Access denied for user 'root'@'localhost' (using password: YES) using MAMP 我的网站被黑,用户&#39;user&#39;@&#39;localhost&#39;的错误MYSQL访问被拒绝(使用密码:是) - My site is hacked, error MYSQL Access denied for user 'user'@'localhost' (using password: YES) 用户&#39;homestead&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:是)pdo异常 - Access denied for user 'homestead'@'localhost' (using password: YES) pdo exception 连接失败:用户 &#39;&#39;username&#39;@&#39;localhost&#39; 访问被拒绝(使用密码:YES) - Connection failed: Access denied for user ''username'@'localhost' (using password: YES) 用户&#39;dbtsorder&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:是) - Access denied for user 'dbtsorder'@'localhost' (using password: YES) 用户&#39;username&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:是) - Access denied for user 'username'@'localhost' (using password: YES) 用户 &#39;root&#39;@&#39;localhost&#39; 的访问被拒绝(使用密码:YES)&#39; - Access denied for user 'root'@'localhost' (using password: YES)' 用户 &#39;homestead&#39;@&#39;localhost&#39; 访问被拒绝(使用密码:YES) - Access denied for user 'homestead'@'localhost' (using password: YES) 用户&#39;root&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:是) - Access denied for user 'root'@'localhost' (using password: YES) #1045-用户&#39;root&#39;@&#39;localhost&#39;的访问被拒绝(使用密码:是) - #1045 - Access denied for user 'root'@'localhost' (using password: YES)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM