niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » PHP
Connect to remote MySQL server
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Martin
*nix forums beginner


Joined: 21 Jul 2006
Posts: 2

PostPosted: Fri Jul 21, 2006 8:20 am    Post subject: Connect to remote MySQL server Reply with quote

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:

$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.
Back to top
Jerry Stuckle
*nix forums Guru


Joined: 24 Feb 2005
Posts: 1515

PostPosted: Fri Jul 21, 2006 12:22 pm    Post subject: Re: Connect to remote MySQL server Reply with quote

Martin wrote:
Quote:
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:

$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.
jstucklex@attglobal.net
==================
Back to top
Martin
*nix forums beginner


Joined: 21 Jul 2006
Posts: 2

PostPosted: Fri Jul 21, 2006 2:02 pm    Post subject: Re: Connect to remote MySQL server Reply with quote

Jerry Stuckle wrote:
Quote:
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,$username,$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.
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Sat Nov 22, 2008 8:15 pm | All times are GMT
navigation Forum index » Programming » PHP
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts postfix smtp authentication using mysql stored user/pass rtresidd Postfix 0 Fri Oct 03, 2008 5:58 am
No new posts Postfix + MySQL error: very strange variable %s iWarior Postfix 0 Mon Aug 25, 2008 2:01 pm
No new posts Transfer qmail email account to postfix server tallman Postfix 0 Thu Jun 05, 2008 12:43 pm
No new posts Postfix sending problem for local domain remote email monkey_magix Postfix 0 Mon Sep 10, 2007 10:17 am
No new posts NFS server on Solaris 10 gurgle Solaris 0 Tue Sep 04, 2007 7:05 pm

Unsecured Loans | Singapore Shopping Guide | Personal Loans | Download Korean movies | Loan
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2289s ][ Queries: 16 (0.1461s) ][ GZIP on - Debug on ]