I have a number of users who are connecting to MySQL over a VPN, so we have grants along the lines of grant select on foo.* to user@ipaddress1
and so on.
This week, the IP used on the VPN changed to address2, so user@ipaddress1
grants no longer work.
What's the best way to handle updating the user and grant information in MySQL to reflect this change?
Note that the grants are a serious mess, because some users are excluded from particular columns in particular tables, so we've had to do grants around the excluded objects.
Apparently, the right way to do this is:
http://dev.mysql.com/doc/refman/5.0/en/rename-user.html
This takes care of all the grants.
Just update the host field in your MySQL user table:
If you have a dedicated subnet for your VPN users the following syntax works well.