Your mysql connection string contains a selection from 5 parameters
- server identifier ("localhost", IP address, url, etc)
- port number (not required, most mysql installs use the default)
- username
- password
- database name
You just need to replace the "localhost" with the address (IP/URL etc) of the remote server.
Rule out any PHP confusion and try connecting to the mysql server from the command line
"mysql - h 123.123.123.123 -u username -p databasename"
(if I recall correctly)
(Replacing 123.123.123.123, username and databasename with your details)
This will prompt you for the password and should let you in.
If not, see what error you get, and check with your sysadmin.