Remove MySQL remote access IP from all accounts

kodyxgen

Active Member
Jul 9, 2013
27
2
53
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
 

24x7server

Well-Known Member
Apr 17, 2013
1,912
99
78
India
cPanel Access Level
Root Administrator
Twitter
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 ?
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..
 

kodyxgen

Active Member
Jul 9, 2013
27
2
53
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..
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.
 

24x7server

Well-Known Member
Apr 17, 2013
1,912
99
78
India
cPanel Access Level
Root Administrator
Twitter
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..