The answer is... maybe. If the way described in the two answers above doesn't work, your MySQL server host has a restriction on IPs querying the database. This way the hoster ensures you only use the domains booked with them, instead of running one domain there with the MySQL feature and the others with a less expensive hoster.
I came across that nasty 'feature' when I tried to synchronize my local IDE from Firepages with my online db hosted at one of those 'inexpensive' ones. The script ran locally, sending queries to the online db, but was declined access. The workaround was to query MY db from a script running on the online host, using $REMOTE_ADDR to figure out who I am (IP changes with every dialup). Putting the $REMOTE_ADDR in the 'host' var for connection worked fine, as did the script. If you need it, drop me a fast line.
Joerg
www.surfspot-magazine.com