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.

Remove MySQL remote access IP from all accounts

Discussion in 'Database Discussions' started by kodyxgen, Sep 15, 2017.

  1. kodyxgen

    kodyxgen Member

    Joined:
    Jul 9, 2013
    Messages:
    23
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    Hello,
    I need to delete all remote mysql ip's from cPanel user accounts, is there any possibility to do this from ssh so i don't have to enter in every account and delete the ip address ?
     
  2. kodyxgen

    kodyxgen Member

    Joined:
    Jul 9, 2013
    Messages:
    23
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    I found a solution, i don't know if it is the best but i will share it with you so if anybody will be in the same situation.
    in mysql database there are two tables that i altered the db one and the user one, this of course after taking a dump of them.
    I deleted all the `host` that where added there with an sql
    Code:
    DELETE FROM `user` WHERE `host` NOT IN (and here i put my server main ip and hostname) and user <> root
    And i did the same thing for the db table to.

    and all the remote mysql ip's where gone from cPanel user account's
     
  3. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,484
    Likes Received:
    60
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    If you have a CSF installed, all you have to do is disable the IP access to the port 3306 for those users and after doing so, even if they have enabled remote MySQL, your server firewall is still not going to allow them to access it..
     
  4. kodyxgen

    kodyxgen Member

    Joined:
    Jul 9, 2013
    Messages:
    23
    Likes Received:
    1
    Trophy Points:
    3
    cPanel Access Level:
    Root Administrator
    Thank you for your response.
    I have CSF installed and that would it be the solution if i head 10 - 20 accounts but i have more than that and some of them really need remote mysql connection.
    Thank you once more for taking the time to respond.
     
  5. 24x7server

    24x7server Well-Known Member

    Joined:
    Apr 17, 2013
    Messages:
    1,484
    Likes Received:
    60
    Trophy Points:
    28
    Location:
    India
    cPanel Access Level:
    Root Administrator
    Hi,

    Anyways, to have the Remote MySQL connection worked properly, you will need the IP also added to the firewall, so you can allow only legitimate one those require the connection and others those you have this enabled in cPanel, will still not be able to access it as the firewall is already guarding the connection to the database port..
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

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

Share This Page