I'm having trouble connecting to MySQL from a remote host using PHP. I have no problems connecting to the database from 'localhost', but when I change the host to mydomain.com and try to access it from a remote computer I get this error:
Warning: Can't connect to MySQL server on 'mydomain.com' (110) in /usr/local/apache/htdocs/pathtoscript.php on line 11
Warning: MySQL Connection Failed: Can't connect to MySQL server on 'mydomain.com' (110) in /usr/local/apache/htdocs/pathtoscript.php on line 11
I cannot connect to the database because: Can't connect to MySQL server on 'mydomain.com' (110)
I'm trying to connect using this script:
My access hosts in cPanel are % and localhost (this is the part I'm unsure of). I also added my remote IP address but got the same error message.
Anyone have any ideas or gone through the same thing?
Warning: Can't connect to MySQL server on 'mydomain.com' (110) in /usr/local/apache/htdocs/pathtoscript.php on line 11
Warning: MySQL Connection Failed: Can't connect to MySQL server on 'mydomain.com' (110) in /usr/local/apache/htdocs/pathtoscript.php on line 11
I cannot connect to the database because: Can't connect to MySQL server on 'mydomain.com' (110)
I'm trying to connect using this script:
PHP Code:
$dbh=mysql_connect ("mydomain.com:3306", "user", "password") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("database");
Anyone have any ideas or gone through the same thing?
Comment