Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

MySQL connection [moved]

Discussion in 'Database Discussion' started by supplydept, Feb 27, 2006.

  1. supplydept

    supplydept Registered

    Joined:
    Feb 26, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    151
    MySQL connection

    hello.

    using cpanel and php, is it possible to connect to an external mySQL database?

    I used

    mysql_connect("external_host","user","pass")

    with the values filled in.

    I got an error saying:

    Lost Connection to server during query
     
  2. webignition

    webignition Well-Known Member

    Joined:
    Jan 22, 2005
    Messages:
    1,880
    Likes Received:
    0
    Trophy Points:
    166
    Yes, it's possible - I have accounts that connect to external MySQL servers without issue.

    You would need to check the following:

    1. That your server's firewall allows connections out on the correct port
    2. That the external server's firewall allows connections in on the correct port
    3. That the external server's MySQL server allows external connections

    The error you're getting doesn't suggest that point 3 is an issue, so you should really check the firewall setup on both servers first. MySQL runs on port 3306, or so I believe.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. supplydept

    supplydept Registered

    Joined:
    Feb 26, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    151
    hmm...
    okay.

    Numbers 2 and 3 are not the problem b/c i can connect to the external database through my old host.

    Also, do you, as a user, have to have MySQL privelages on cpanel to access an external database? (Even if you don't use a database on the cpanel server)
     
    #3 supplydept, Feb 27, 2006
    Last edited: Feb 27, 2006
  4. supplydept

    supplydept Registered

    Joined:
    Feb 26, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    151
    So does the "Lost Connection to server during query" error have to do with cpanel or just the server that I am hosted on?
     
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice