Connect to remote MySQL server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Martin

    Connect to remote MySQL server

    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_datab ase=mysql_conne ct(localhost,$u sername,$passwo rd) or
    mysql_fail("Una ble to connect to MySQL database.");

    I have edited this to:

    $panorama_datab ase=mysql_conne ct('172.207.??? .???:3306',$use rname,$password )
    or mysql_fail("Una ble 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_datab ase=mysql_conne ct('http://mynoipalias.no-ip.org:3306',$u sername,$passwo rd)
    or mysql_fail("Una ble to connect to MySQL database.");

    and (with no port specified):

    $panorama_datab ase=mysql_conne ct('http://mynoipalias.no-ip.org',$userna me,$password)
    or mysql_fail("Una ble 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.

  • Jerry Stuckle

    #2
    Re: Connect to remote MySQL server

    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_datab ase=mysql_conne ct(localhost,$u sername,$passwo rd) or
    mysql_fail("Una ble to connect to MySQL database.");
    >
    I have edited this to:
    >
    $panorama_datab ase=mysql_conne ct('172.207.??? .???:3306',$use rname,$password )
    or mysql_fail("Una ble 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_datab ase=mysql_conne ct('http://mynoipalias.no-ip.org:3306',$u sername,$passwo rd)
    or mysql_fail("Una ble to connect to MySQL database.");
    >
    and (with no port specified):
    >
    $panorama_datab ase=mysql_conne ct('http://mynoipalias.no-ip.org',$userna me,$password)
    or mysql_fail("Una ble 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@attgl obal.net
    =============== ===

    Comment

    • Martin

      #3
      Re: Connect to remote MySQL server

      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_datab ase=mysql_conne ct(localhost,$u sername,$passwo rd) or
      mysql_fail("Una ble to connect to MySQL database.");

      I have edited this to:

      $panorama_datab ase=mysql_conne ct('172.207.??? .???:3306',$use rname,$password )
      or mysql_fail("Una ble 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_datab ase=mysql_conne ct('http://mynoipalias.no-ip.org:3306',$u sername,$passwo rd)
      or mysql_fail("Una ble to connect to MySQL database.");

      and (with no port specified):

      $panorama_datab ase=mysql_conne ct('http://mynoipalias.no-ip.org',$userna me,$password)
      or mysql_fail("Una ble 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.

      Comment

      Working...