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 connection [moved]

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

  1. supplydept

    supplydept Registered

    Joined:
    Feb 26, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    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:
    36
    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.
     
  3. supplydept

    supplydept Registered

    Joined:
    Feb 26, 2006
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    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:
    1
    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