There could be 2 problems.
1 - the server is blocking MySQL's port (3306) if this is the case you need to get the administrator of the server to open up that port.
2 - the username that you are using to connect doesn't have permission to connect from the IP address that you are currently calling from. MySQL uses name/host verification so that you can be very restrictive of people accessing the database. You'll need to logon to the server hosting MySQL then login to MySQL and check the record in the users table to see if the host is set to localhost for your web user. If so you need to change this to %, or the hostname of the web server.