When creating a user account in MySQL it is possible to provide similar usernames, with the same or different passwords depending on where they are logging in from. If you check the mysql.users table you will see the Host and User columns. These two columns are used when determining access. I think this is best explained using an example:
Imagine I have the following users in the system:
User Host
Ron localhost
Ron example.com
Ron %
Note these are three different users. MySQL authentication will attempt to identify the one that matches your login username and host combination to see which one to use. Let us say we are logging in from localhost with the user Ron then the first entry will be used. If we login from example.com then the second entry will be used for authentication. Finally any other connection with that user from any other host will use the 3rd entry.
In your case it is very likely that you have only one entry in the users table for localhost only. As a result, you can connect from localhost but not from any other host. You will need to add another entry to the database or change the one that exists there (using the wildcard % as host).
Hope this helps
Ronan Cashell
Senior Oracle/MySQL Administrator
IT Integrated Business Solutions
http://www.it-iss.com