I am trying to connect my Database on PhpMyAdmin with my webPage. However I keep getting this error:
Connection failed: Access denied for user 'root'@'localhost' (using password: NO)
My code (php) is:
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "db_client2";
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
?>
I do not understand what is wrong:
[enter image description here][1]
[1]: https://i.stack.imgur.com/vYBYy.png
Hope you can help me, thank you in advance.
2
Answers
Please enter a password to the phpcode $password = “”;
phpmyadmin disabled root login by default.
If you want to allow root login you will have to update /etc/phpmyadmin/config.inc.php and set
Also mysql change the ability to login from root out of the shell.
please see this link https://askubuntu.com/questions/763336/cannot-enter-phpmyadmin-as-root-mysql-5-7
The recommendation is to create an account other than root and grant all privileges.