Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Nov 2005
    Posts
    13

    Default mysql remote server connection - other threads dont help

    Hi,

    I am trying to connect to my own server (mysql), from another server i just bought.

    I searched the net to no avail, and this thread doesnt work for me (http://forums.cpanel.net/showthread.php?t=78345)

    I have added the new servers ip to my old servers firewall, and it still wont connect, i get this error.

    Can't connect to MySQL server on '*.*.*.*' (4)
    This is the php code i am using....

    // Database configuration details:
    $dbHost = "*.*.*.*:3306";
    $dbUser = "user";
    $dbPass = "password";
    $dbName = "database";

    // Connect to MySQL:
    if (!$dbase = @mysql_connect($dbHost, $dbUser, $dbPass))
    {
    die(mysql_error());
    }

    Any simple instructions on how to do this please?

    Thanks!

  2. #2
    Member
    Join Date
    Nov 2005
    Posts
    13

    Default

    I have also followed instructions on this page (http://www.cpanel.net/support/docs/1..._acchosts.html)

    and it still wont connect? same error msg

  3. #3
    cPanel Development cpanelkenneth's Avatar
    Join Date
    Apr 2006
    Posts
    3,788
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    1. Is MySQL on your SQL server configured to listen on TCP port 3306?

    2. Is your MySQL server accessible from your new server (e.g. you can ping the MySQL server from your new cPanel server)?

    3. Is the access GRANT for the MySQL user correct (e.g. the Host field either has % or the IP address/hostname connecting from)?

  4. #4
    Member
    Join Date
    Nov 2005
    Posts
    13

    Default

    Quote Originally Posted by cpanelkenneth View Post
    1. Is MySQL on your SQL server configured to listen on TCP port 3306?

    2. Is your MySQL server accessible from your new server (e.g. you can ping the MySQL server from your new cPanel server)?

    3. Is the access GRANT for the MySQL user correct (e.g. the Host field either has % or the IP address/hostname connecting from)?
    Hi Kenneth,

    Thanks for taking the time to answer my thread.

    1. yes, port 3306 is open in the csf firewall
    2. the new server is a shared non cpanel server, so i got the server admin to ping on my behalf and it pinged ok.
    3. yes this is setup


    Are there any other tests i can do from the new server to see if it can connect to the sql server?
    Last edited by davestacey; 11-12-2008 at 10:31 AM.

  5. #5
    Member
    Join Date
    Nov 2005
    Posts
    13

    Default

    Still the same issue.

  6. #6
    Registered User
    Join Date
    May 2007
    Posts
    4

    Default

    Try this from new server, and see if you are able to connect.

    telnet oldserver.com 3306

    (Replace oldserver.com with your old servername/IP)

  7. #7
    cPanel Partner NOC cPanel Partner NOC Badge anton_latvia's Avatar
    Join Date
    May 2004
    Posts
    277

    Default

    There are many things that can happen - firewall on your local server, firewall on the new serve blocking outgoing connections (do you have ConfigServer Firewall installed or may be default iptables rules are enabled?). Then your mySQL server might deny network connections, please give us content of /etc/my.cnf. Then - did you try to connect through shell? (mysql -h REMOTE_ADDR -u USERNAME -p). If this does not work - what exact error do you get?

    Anton.
    * http://www.aleksandrov.eu/ - just a simple personal homepage.

Similar Threads & Tags
Similar threads

  1. remote connection mysql
    By rioweb in forum cPanel and WHM Discussions
    Replies: 8
    Last Post: 12-08-2008, 04:31 PM
  2. MySQL remote connection?
    By brettz9 in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 07-04-2006, 11:41 PM
  3. Remote MySQL connection problem
    By ialex03 in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-06-2004, 08:53 AM
  4. Mysql - Remote connection
    By DHL in forum cPanel and WHM Discussions
    Replies: 9
    Last Post: 11-24-2003, 02:20 PM
  5. Remote server mysql connection
    By vishal in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-20-2003, 12:59 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube