'Additional MySQL Access Hosts' issue

Indianets

Well-Known Member
PartnerNOC
Jun 13, 2008
69
0
56
cPanel Access Level
Root Administrator
Hello,

I added an IP (say 1.2.3.4) on a server in WHM > Additional MySQL Access Hosts.

And added it to all cPanels by clicking --- "After you have done this, if you would like to configure access from all users' accounts, Click Here.". I could see 1.2.3.4 was added under all cPanels of the server under 'Remote MySQL Hosts'.

Now I want to remove this IP completely, so I removed from WHM and again clicked to configure all clients, but this does not remove 1.2.3.4 from all cPanels. How can I do this?

Vijay
 

minosjl

Well-Known Member
Jun 4, 2011
168
0
66
India
cPanel Access Level
Root Administrator
Hi,

I think this is because of the cpanel cache.Could you please check your ip address is exists in the dir /var/cpanel/databases

you can run the command grep ip /var/cpanel/databases/* , if its exists you can update the cache by running the cpanel binary " /usr/local/cpanel/bin/setupdbmap "

Please check this from your end and update this post.Your reply is much appreciated ....
 

Tam

Well-Known Member
Jul 31, 2004
109
2
168
Same issue, and the above did not resolve it. Seems there is no 'undo' for the 'do'.
 

Indianets

Well-Known Member
PartnerNOC
Jun 13, 2008
69
0
56
cPanel Access Level
Root Administrator
Hi Tam,

After a bit of research, I could find that it's all stored in --

Code:
/var/cpanel/databases/grants_cpuser.yaml
in format --

Code:
---
MYSQL:
  cpuser:
    cpuser:
      - GRANT USAGE ON *.* TO 'cpuser'@'1.2.3.4' IDENTIFIED BY PASSWORD '*XXXXXXXXXXXXXXXXXXXX'
      - GRANT USAGE ON *.* TO 'cpuser'@'localhost' IDENTIFIED BY PASSWORD '*XXXXXXXXXXXXXXXXXXXX'
cpuser => users which show the IP under cPanel > Remote Database Access Hosts
1.2.3.4 => The IP which we applied to all and couldn't be removed.

It would be best if someone from cPanel can have a word on 'How Safe is to remove that line?'.

Vijay
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Removing the line only removes the mapping for the cPanel file. It doesn't remove the SQL in the /var/lib/mysql/mysql table that stores the grants for the IPs. You'd have to remove them in MySQL command line, or in each individual cPanel.
 

Indianets

Well-Known Member
PartnerNOC
Jun 13, 2008
69
0
56
cPanel Access Level
Root Administrator
Tristan,

I have checked the tables in db 'mysql' and the IP was not there. Could it be due to removing the IP from WHM and running for all account by clicking "click here".

I mean I made the remote host textarea blank in WHM and then came back and updated for all users, which did update something for all users one by one in GUI. That probably removed the grants from mysql actually which you are referring to.

It's always best to test, if possible, could you please test it's behavior on your test machine?

Vijay
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
In my tests, this did not occur. If I removed the IP in WHM > Additional MySQL Access Hosts area, then clicked "Save", I receive an error message:

MySQL access hosts saved.
Invalid MySQL hosts

.
Next, if I then click the "Click Here" link below that, while it does show the various users updating, when I check /var/lib/mysql/mysql database, the mysql.user table still lists the IP under the database users who had it previously added as a Host.

My test machine is running cPanel EDGE 11.31.3.3