Normally, if your application server and database server are sitting in 2 different server, you are unable to connect from application server to the database server without granting access rights in the mysql database. To grant the access rights, below are the command which you can cut and paste into your mysql browser and run.
GRANT ALL PRIVILEGES ON *.* TO username@address IDENTIFIED BY “password”;
username = [USER ID] in the application server
address = [IP Address of the remote machine]
password = [PASSWORD of the USER ID]
Once run the script, voila! you get the rights to connect to the database server from application server.