简体   繁体   中英

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. I have already created a db/user and uploaded sql to my phypmyadmin

Error I am getting is

Access denied for user 'user'@'localhost' (using password: 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 
$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(); }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM