If you run MySQL dependent applications, you have probably hit this scenario at some stage. You're trying to install some software that requires MySQL and are using the correct details; but a MySQL connection can't be made.
Your hosting service says the problem is in the installation routine of the software, the software author says it's your hosting service – and back and forth you go between host and vendor until someone finally accepts responsibility and fixes the issue. A lot of time can be wasted, and time is money; not to mention the great deal of frustration that can occur.
There's a simple script for testing connectivity that should help settle the issue. Here's what to do:
1. Check your hosting account control interface to ensure that the database is present and you have a user set up for that database. Also ensure you have the right password for the db.
2. Create an empty file with a text editor and save it as mysqltest.php
3. Add the following to that file:
Replace hostname (usually localhost), username and password with the details you have for your database. There's no need to add the database name.
4. Upload to your server to a folder that's viewable via a browser.
5. Load the file in your browser
If a connection is made, the resulting page will display ‘Connection OK'. Talk again with the software vendor and give them the URL to the script.
If a connection cannot be made, then you'll probably see something like:
Warning: mysql_connect(): Access denied for user ‘dbuser'@'localhost' (using password: YES) in /path/to/mysqltest.php on line 2 Could not connect to MySQL: Access denied for user ‘dbuser'@'localhost' (using password: YES)
Copy and paste that error and send it to your web host, along with the details of your database.
Don't forget to remove the file once the issue is settled.
Article Source: http://EzineArticles.com/?expert=Michael_Bloch