Connect to remote MySQL server

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi all.

I have a fully functional page hosted on my PC that uses PHP and
connects to MySQL on my PC to generate it's code.

I now have some web hosting available which includes both PHP and MySQL
support, however the webhost is still in the process of getting the
MySQL support activated and functional.

I therefore have uploaded my webpage to the host and edited the webpage
code to access the MySQL server on my home PC - once the host gets
MySQL working then the webpage will of course use the MySQL that my
host will provide.

The original code in my webpage to connect to MySQL is:

$panorama_database=mysql_connect(localhost,$username,$password)  or
mysql_fail("Unable to connect to MySQL database.");

I have edited this to:

 or mysql_fail("Unable to connect to MySQL database.");

(My IP masked by ???).
And it's works no problems - however i have a dynamic IP address and
wish to replace the hardcoded IP address with an alias from

So i tried both:

$panorama_database=mysql_connect(' ',$username,$password)
 or mysql_fail("Unable to connect to MySQL database.");

and (with no port specified):

$panorama_database=mysql_connect(' ',$username,$password)
 or mysql_fail("Unable to connect to MySQL database.");

Both attempts to use my alias fail and i'm not sure where
to look for logs to debug the problem.

Can anyone suggest where i'm going wrong?
I've successfully allowed remote access to MySQL on my home PC in my
firewall settings - and as the hardcoded IP address works i know that's
unlikely to be the problem.

Thanks for any help.


PS It's not the end of the world if i can't get this working - i hope
my web host gets the MySQL support sorted within a day and i'll not
need to access MySQL on my PC from my new web host.

Re: Connect to remote MySQL server

Martin wrote:
Quoted text here. Click to load it

Don't use http:.  This isn't using hypertext transfer protocol.  Your  
web server would be just  And you shouldn't need  
the 3306 either, since that's the default (guess it doesn't hurt to have  
it in there, though).

Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.

Site Timeline