I am running an XAMPP stack on Windows XP as a test environment and am trying to make my first connection to a mysql database using a connection script in "Sams Teach Yourself PHP, MySQL and Apache" by Julie Meloni. I successfully built the database, created the user and confirmed the user's existance by looking under the "privileges" tab in phpMyAdmin, where I saw this:
Users having access to "testDB":
User Host Type Privileges Grant Action
jouser localhost database-specific ALL PRIVILEGES No
root 127.0.0.1 global ALL PRIVILEGES Yes
root localhost global ALL PRIVILEGES Yes
Next I ran the script below:
<?php
$mysqli = new mysqli("localhost","jouser","somepass","testDB");
if(mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
} else {
printf("host information: %s\n", mysqli_get_host_info($mysqli));
}
?>
And then got this error:
Warning: mysqli::mysqli() [mysqli.mysqli]: (28000/1045): Access denied for user 'joeuser'@'localhost' (using password: YES) in C:\xampp\htdocs\mysqlconnect.php on line 2
Connect failed: Access denied for user 'joeuser'@'localhost' (using password: YES)
Although the author explains that this is the error you get if the connection fails, she provides no clue as to how to troubleshoot this.
Can anyone give me some help ?