Page 1 of 1

Connect to online MySQL from localhost

Posted: Sat May 08, 2010 11:15 am
by hypedupdawg
I have recently looked at utilizing the MySQL aspects on my webserver, and have come across this rather annoying problem - when I try to connect from my localhost testing server, I get this error;
Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'sql313.byethost17.com' (10060)
...however, from my proper server it connects straight away. I have looked around, and cannot find any mention of this problem anywhere. The syntax I am using is the standard:

Code: Select all

<?php
mysql_connect("sql313.byethost17.com","username", "password") or die(mysql_error());
?>
Is there another command I need to add to get it to connect to an online server? Is it my firewall / ports interfering? Will I have egg on my face tomorrow for a blatant error?

I am using the server Byethost; I don't know if it makes a difference.

Re: Connect to online MySQL from localhost

Posted: Sat May 08, 2010 11:18 am
by John Cartwright
Generally the servers are setup to only allow specific hosts to connect. Therefore, you need to contact your host, or if you have cpanel (among other control panels) you can usually whitelist additional hosts.

Moved to Installation and Configuration.

Re: Connect to online MySQL from localhost

Posted: Sat May 08, 2010 5:32 pm
by Doug G
Try connecting from your local workstation command line mysql program. You'll see more info about what's wrong.

Also as mentioned contact your host. My hosting company allows remote mysql server access, but not all hosts allow such access. Some, as mentioned, restrict access to specific remote machines. Some hosts don't allow remote access at all, and expect you to do all your db administration from phpMyAdmin or some other program that runs on their server.