I keep receiving an error of "Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO)" when trying to connect to mysql database using mysqli. I have created a simple php program to connect to a database in mysql using sqli(see below). I am currently using wamp64 and have been trying to solve this error for a very long time. At current I have phpmyadmin login username as root and not requiring a password, I do not have an issue when logging into phpmyadmin, just am not able to connect to any of the databases I have created. When researching this error I have found nothing similar to what I am experiencing. Is it possible something could be wrong with my configuration settings? I am also using Windows 10 operating system.
<?php
$hostname = "localhost";
$username = "root";
$password = "";
$dbname = "newestdatabase";
$conn = mysqli_connect($hostname, $username, $password, $dbname);
if ($conn) {
echo "Connection success.";
}
?>