The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

MySQL remote connection?

Discussion in 'General Discussion' started by brettz9, Apr 6, 2005.

  1. brettz9

    brettz9 Member

    Joined:
    Apr 6, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    I was wondering if anyone knew with what IP address I would need to replace "localhost" in a MySQL command to connect from a remote location...I am also wondering whether I need to add a host on the SQL databases page to allow this to happen, in which case I'd also like to know how to find out which IP address to use for that as well...

    thank you in advance,
    Brett
     
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    36
    When connecting to a MySQL database on a given server from a different server, replace "localhost" with the IP address of the machine running the MySQL database.

    In the MySQL section in Cpanel, you'd need to add the IP of the machine from which you want to access the database in the "Access hosts" section.

    To give an example:

    Server A with IP address 123.123.123.123 is running a MySQL database
    Server B with IP address 231.231.231.231 wants to access the MySQL database on server A.

    When connecting to the MySQL database on server A from server B, replace "localhost" in the MySQL connect command with 123.123.123.123.

    In Cpanel on server A, add the IP address 231.231.231.231 (server B) to the "Access hosts" section on the MySQL page.
     
  3. brettz9

    brettz9 Member

    Joined:
    Apr 6, 2005
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    Thanks

    Thank you for clarifying that for me...

    I guess the reason my entering the domain earlier did not work was only because I hadn't enabled the remote login for my IP address...

    thanks again,
    Brett
     
  4. chaloupe

    chaloupe Well-Known Member

    Joined:
    Mar 17, 2006
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Dieppe, NB, Canada
    Is there a way to do a test to see if it's connecting properly?

    From a remote server to a MySQL database on another server..
     
  5. chaloupe

    chaloupe Well-Known Member

    Joined:
    Mar 17, 2006
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Dieppe, NB, Canada
    I think our server itself is not letting any outside connection to the MySQL service. Is there a files or settings we need to do to allowed remote website to connect to a MySQL database remotely?
     
  6. wptechno

    wptechno Active Member

    Joined:
    Jun 10, 2004
    Messages:
    42
    Likes Received:
    0
    Trophy Points:
    6
    did anyone figure this one out?

    I keep getting an error when trying to connect remotely.
     
  7. chaloupe

    chaloupe Well-Known Member

    Joined:
    Mar 17, 2006
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Dieppe, NB, Canada
    I have a dedicated server with HG and I had not been able to make a remote connection form my server in Dallas to a remote server in Canada....

    I have check to make sure that I have added the IP of the remote server, check in the MySQL admin for the user to be the IP instead of @localhost.....

    It seems that I have not been able to make it work at this time. I about to take an account of shared web hosting just to check If I am able to make it connect in case that my Canadian server was not ready for connection on port 3306.
     
Loading...

Share This Page