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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED Remote MYSQL Access Connection

Discussion in 'Database Discussions' started by orrevs, May 25, 2017.

Tags:
  1. orrevs

    orrevs Registered

    Joined:
    May 9, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Swe
    cPanel Access Level:
    Root Administrator
    I recently moved my sites to a new server, on my old server Remote MYSQL worked fine.
    All i did was add my ip in the white list in cPanel.

    Now with the new server this does not work.

    I have added my ip in cPanel Remote Mysql whitelist.
    I have added my ip in the Global MYSQL Host list in WHM.

    I have also checked the iptabels and i cannot find anything that would block.

    The server i run have multiple ips. I have tested to connect to my main servers IP and port 3306
    And also the deddicated ip of the cPanel account and port 3306. I get connection Refused when i try from Putty.

    Question is

    Is there any error log i can check for not allowed connections so i can try find the issue?

    Server OS: CENTOS 7.3

    This is a short list from iptabels
    [root@ns3057874 lib]# iptables --list
    Chain INPUT (policy ACCEPT)
    target prot opt source destination
    cphulk all -- anywhere anywhere
    cP-Firewall-1-INPUT all -- anywhere anywhere
    ACCEPT tcp -- anywhere anywhere tcp dpt:mysql
    ACCEPT tcp -- anywhere anywhere tcp dpt:mysql
    ACCEPT tcp -- Thisismyhost-no195.tbcn.telia.com anywhere tcp dpt:mysql

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination
    cP-Firewall-1-INPUT all -- anywhere anywhere

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination
    ACCEPT tcp -- anywhere anywhere multiport dports smtp,urd,submission owner GID match mailman
    ACCEPT tcp -- anywhere anywhere multiport dports smtp,urd,submission owner GID match mail
    ACCEPT tcp -- anywhere localhost.localdomain multiport dports smtp,urd,submission owner UID match cpanel
    ACCEPT tcp -- anywhere anywhere multiport dports smtp,urd,submission owner UID match root
    cpanel-dovecot-solr all -- anywhere anywhere
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you try using the "telnet" command from the remote server that's making the connection to your MySQL service? EX:

    Code:
    telnet domain.tld 3306
    Does this connection succeed or fail? Also, you may want to try installing a firewall management tool such as CSF and then configuring CSF to allow connections to port 3306 (or adding a specific host or IP to the whitelist):

    ConfigServer Security & Firewall (csf)

    Thank you.
     
  3. orrevs

    orrevs Registered

    Joined:
    May 9, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Swe
    cPanel Access Level:
    Root Administrator
    Thank you for response

    I have installed it now, but when i look at listening open ports the 3306 is not displayed.

    Ports listening for external connections and the executables running behind them:

    there is no 3306 port here. Do i need to enable it some how?

    Mysql works fine locally on all sites just not remote but how can it work if port is not listening?
     
  4. orrevs

    orrevs Registered

    Joined:
    May 9, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Location:
    Swe
    cPanel Access Level:
    Root Administrator
    I found the issue,

    in /etc/my.cnf i had to remove bind-address=127.0.0.1

    Apperently if local adress is binded you cannot connect remotly!

    Thanks!
     
    cPanelMichael likes this.
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,427
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    I'm happy to see the issue is now solved. Thank you for updating us with the outcome.
     
  6. Hawar Koyi

    Hawar Koyi Registered

    Joined:
    Jun 10, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Norway
    cPanel Access Level:
    Root Administrator
    You can also change it into bind-address=*
    Then restart MySQL service (service mysql restart)
     
Loading...

Share This Page