I have a database server and an application server and trying to connect my application server the remote database server using PHP.
As usual I used the following way to it in the following manner.
<?php
mysql_connect("remotedb.com", "mysqladmin", "mysqlpassword") or die(mysql_error());
echo "Connected to MySQL<br />";
?>
But when I am trying to run this test I am getting the following error.
Warning: mysql_connect() [function.mysql-connect]: Host 'gator418.hostgator.com' is not allowed to connect to this MySQL server in /home/username/public_html/testmysql.php on line 2
Host 'gator418.hostgator.com' is not allowed to connect to this MySQL server
I have added the domain as %www.myappserver.com% to the remote server’s cpanel “Remote MySQL” but still the issue persists. Can anyone tell me why am I getting this error?
Remote database username is not allowed to connect using your host. Most probably it is set to only be able to connect from “localhost”, so check the details of your username on your mysql server and see the list of allowed hosts