I'm trying to connect my PHP to my XAMPP DB server, but as it seems I'm not doing something right. This is my code:
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$db= "blogdata";
// Create connection
$conn = new mysqli($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>
And it returns:
Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'username'@'localhost' (using password: YES) in C:\xampp\htdocs\KungFu\Blog.php on line 8 Connection failed: Access denied for user 'username'@'localhost' (using password: YES)
I think everything is correct, tried different variations but as you can tell it is not working.