I'm trying to write a Wordpress 2.8 widget. The widget will need to access a MySql database. I have a connection script that does this:
>// Set database info
define('DB_HOST', 'my-domain-name.com');
define('DB_USER', 'myhome_username');
define('DB_PASSWORD', '********');
define('DB_DATABASE', 'myhome_databasename');
// connect to the database
$mysql = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE)
or die('Could not connect: ' . mysql_error());
$db_selected = mysql_select_db('myhome_databasename', $mysql);
if (!$db_selected) {
die ('Can\'t use myhome_databasename : ' . mysql_error());
}
When the script runs and tries to connect I receive this error:
>Can't use myhome_databasename : Access denied for user 'myloginid'@'%' to database 'myhome_databasename'
I just cannot figure out where the Mysql server is getting the "myloginid" -- I would have expected an error with "myhome_username". Anybody have any idea what could cause this? I've been looking at it so long my eyeballs are falling out. I have set up the remote access to allow "%" and have added user "myhome_username" to "myhome_databasename"
If I fall back to using a local mysql database on my XAMPP installation everything works just fine of course. Any help is appreciated.