By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,543 Members | 1,887 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,543 IT Pros & Developers. It's quick & easy.

Connect to remote MySQL server

P: n/a
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,$userna me,$password) or
mysql_fail("Unable to connect to MySQL database.");

I have edited this to:

$panorama_database=mysql_connect('172.207.???.???: 3306',$username,$password)
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
www.no-ip.com.

So i tried both:

$panorama_database=mysql_connect('http://mynoipalias.no-ip.org:3306',$username,$password)
or mysql_fail("Unable to connect to MySQL database.");

and (with no port specified):

$panorama_database=mysql_connect('http://mynoipalias.no-ip.org',$username,$password)
or mysql_fail("Unable to connect to MySQL database.");

Both attempts to use my www.no-ip.com 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.

Martin.

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.

Jul 21 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Martin wrote:
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,$userna me,$password) or
mysql_fail("Unable to connect to MySQL database.");

I have edited this to:

$panorama_database=mysql_connect('172.207.???.???: 3306',$username,$password)
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
www.no-ip.com.

So i tried both:

$panorama_database=mysql_connect('http://mynoipalias.no-ip.org:3306',$username,$password)
or mysql_fail("Unable to connect to MySQL database.");

and (with no port specified):

$panorama_database=mysql_connect('http://mynoipalias.no-ip.org',$username,$password)
or mysql_fail("Unable to connect to MySQL database.");

Both attempts to use my www.no-ip.com 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.

Martin.

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.
Don't use http:. This isn't using hypertext transfer protocol. Your
web server would be just mynopalias.no-ip.org. 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.
js*******@attglobal.net
==================
Jul 21 '06 #2

P: n/a
Jerry Stuckle wrote:
Martin wrote:
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,$userna me,$password) or
mysql_fail("Unable to connect to MySQL database.");

I have edited this to:

$panorama_database=mysql_connect('172.207.???.???: 3306',$username,$password)
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
www.no-ip.com.

So i tried both:

$panorama_database=mysql_connect('http://mynoipalias.no-ip.org:3306',$username,$password)
or mysql_fail("Unable to connect to MySQL database.");

and (with no port specified):

$panorama_database=mysql_connect('http://mynoipalias.no-ip.org',$username,$password)
or mysql_fail("Unable to connect to MySQL database.");

Both attempts to use my www.no-ip.com 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.

Martin.

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.

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

SNIP>

Brilliant - works a treat!

Many thanks.

Martin.

Jul 21 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.