MySQL Forums
Forum List  »  PHP

Access denied issue
Posted by: Bob Sweeney
Date: February 13, 2019 06:04PM

I am running MySQL Server version: 5.7.25-0ubuntu0.16.04.2 - (Ubuntu).

When I run this php script below with the CORRECT MySQL root user password entered I get the error:
Access denied for user 'root'@'localhost' (using password: NO)

However if I change the root user to an INCORRECT value I get the MySQL error:
Access denied for user 'root'@'localhost' (using password: YES)

I know the MySQL root user password I'm entering is correct because I can log into both the mysql command line and phpmyadmin with it.

So the CORRECT password when received by MySQL is returning access denied using password NO but I don't understand why it would do that. Any help is much appreciated.


<?php
$dbusername = "root";
$dbpassword = "password";
$dbname = "JMDB";
$dbtable = "JM_songs";

$con=mysqli_connect("localhost",$dbusername,$dbpassword,$dbname);
// Check connection
if (mysqli_connect_errno())
{
echo " " . mysqli_connect_error();
}

?>

Options: ReplyQuote


Subject
Written By
Posted
Access denied issue
February 13, 2019 06:04PM
February 13, 2019 07:27PM
February 14, 2019 09:49AM
February 14, 2019 11:03AM
February 14, 2019 11:14AM
February 14, 2019 03:40PM
February 14, 2019 07:18PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.