I wrote the code block below on my local Windows 7 PC and tried to run it. Unfortunately, I received:
Connect Error (1045) Access denied for user 'dbuser'@'myhost(using password: YES)
/* Set Variables */
/* Attempt to connect */
die('Connect Error (' . mysqli_connect_errno() . ') '
echo 'Success... ' . $mysqli->host_info . "\n";
Make sure that if you're using a hostname for the
GRANT in MySQL, that MySQL can properly resolve that hostname to the IP you're connecting from.
For instance, if you do
GRANT blah ON *.* to user@somehost
you have to remember that MySQL won't see 'somehost', it'll see an IP address. It'll have to do a reverse lookup to get a hostname, and if the IP either doesn't have a reverse mapping, or maps to something completely different, MySQL won't give access.
Unless you can guarantee that the reverse mapping is stable, it's best to use IP addresses for remote access accounts in MySQL.