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!

SOLVED cPanel can't connect to MySQL server (Remote)

Discussion in 'Database Discussion' started by Michael Legg, Jan 27, 2018.

  1. Michael Legg

    Michael Legg Member

    Joined:
    Mar 2, 2015
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New Farm, Queensland, Australi
    cPanel Access Level:
    Website Owner
    After running fine for about 3 months. Our cPanel server suddenly can't connect to our MySQL server.

    When I go to the MySQL profile editor and try to validate the MySQL server I get "Failed to “validate” Remote MySQL profile. 1 error occurred Unable to connect to the MySQL host 'xxx.xxx.xxx.xxx' Connection failed with error: Can't connect to MySQL server 'xxx.xxx.xxx.xxx' on (107)

    MySQL is running and I can log in to it locally using the credentials cPanel uses.
    There is nothing relevant in /var/log/mysqld.log on the MySQL server.
    I can ping the MySQL server from the cPanel server, but when I try to connect to MySQL from the cpanel server I get "Can't connect to MySQL server on '192.168.0.11' (113)"

    So one method reports a 107 error and the other reports a 113 error, but there are no further details.

    Has anyone encountered this before?
     
    #1 Michael Legg, Jan 27, 2018
    Last edited: Jan 27, 2018
  2. Michael Legg

    Michael Legg Member

    Joined:
    Mar 2, 2015
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New Farm, Queensland, Australi
    cPanel Access Level:
    Website Owner
    I found the problem, when the MySQL was rebooted last night it didn't load my iptables rules, so it was blocking all remote connections to MySQL.

    I've re-enabled and re-saved the rules, but now I have to work out why they didn't load automatically.
     
  3. Michael Legg

    Michael Legg Member

    Joined:
    Mar 2, 2015
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New Farm, Queensland, Australi
    cPanel Access Level:
    Website Owner
    The problem was that I added my rules to iptables, unaware that Centos 7 uses firewalld to manage the firewall rather than the iptables service. So although the iptables rules work, firewalld is unaware of them and thus does not load them on reboot.

    I've installed the iptables services and disabled firewalld so iptables now manages the firewall and will reload them on boot.
     
  4. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,834
    Likes Received:
    85
    Trophy Points:
    78
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    To have it work even better I would suggest you use ConfigServer Firewall (CSF), which will make it easy for you to manage the firewall and then never face such issue again after a reboot..
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Michael Legg

    Michael Legg Member

    Joined:
    Mar 2, 2015
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New Farm, Queensland, Australi
    cPanel Access Level:
    Website Owner
    Thanks, but it was the firewall on the MySQL server, not the cPanel server that was the problem.
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    44,344
    Likes Received:
    1,852
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm glad to see you were able to solve the issue. Thank you for sharing the outcome.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
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