This may seem like stupid reply and generally a very simple one, but there is two things needed to answer this question appropriately, first are you running the script from the same server that your mysql is installed on? (IE: Webserver and Mysql same computer? "localhost").
If the answer is yes, then make server named "localhost" and make sure all of the correct properties are setup in your mysql database, First under table "host" make sure localhost is setup there, with the proper abilities, hosts should have no rights/privilages, EX: under database mysql, table hosts, fields select_priv/update_priv etc should all be marked as "N" for no. The next step is to make sure your login user is setup and with appropriate settings, the user needs to have the field host setup as same as the host, IE: localhost, and again all the rights/privs are set to N. With the exception of root (in most cases).
And finally make sure your db table is filled out correctly with appropriate permissions for the user/host/db and that they all match the user table and host table.
If the answer is no, then you need to add your server to the list of hosts in the host table under mysql database, you can pretty much follow the steps above for this also.. If host != localhost, write your hosts like this EX: osprey.airewaves.com (thats my server named address).
If you have any more problems please feel free to send me an email or reply to this forum and I'll try my best to help you.
+------------------------------------------+
| ___________ _______ |
| //_/_/_/_/_/ //_/_/_/ |
| //_/ //_/ _/ |
| //_/ //_/ _/ |
| //_/ //_/_/_/ |
+------------------------------------------+
| Tony Devlin - [email]tdevlin@airewaves.com[/email] |
| Airewaves Broadband, Systems Admin |
| Website - [url]www.airewaves.com[/url] |
| Atlanta, Ga - 678.522.3923 |
| Beaufort, SC - 843.379.1720 |
+------------------------------------------+