When I try and connect to my database on XAMPP it gives me this error:
Warning: mysqli::__construct(): (HY000/1045): Access denied for user 'user'@'localhost' (using password: YES)
I have created another user and am logged in to xampp with that. I use the Atom editor and am on macOS Mojave. This is my code -
<?php
$dbhost = "localhost";
$dbuser = "username";
$dbpass = "password";
$db = "dbname";
$conn = new mysqli($dbhost, $dbuser, $dbpass,$db) or die("Connect failed: %s\n".mysqli_connect_error());
echo "Connected Successfully";
return $conn;
mysqli_connect_error();
?>
I have written username and password for confidentiality. It is replaced by my real username and password in my code. The same applies to the 'user'@localhost in the error message