Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: 在用户管理中,可限定多个IP登录。
Requirement Feedback
Please clearly and accurately describe the problem scenario, desired behavior, and background information to facilitate timely follow-up by the product team.
[Problem Scenario Involved in the Requirement]
In production, it is often required to restrict user login by IP. Currently, MySQL can restrict login IPs using _ and %. However, this is still not flexible enough.
[Desired Behavior of the Requirement]
Allow multiple IPs to be separated by commas , in the host field of the mysql.user table.
For example, restrict the admin user to log in only from the addresses 192.168.3.221 and 192.168.3.10. The corresponding host field would be 192.168.3.221,192.168.3.10.
CREATE USER 'admin'@'192.168.3.221,192.168.3.10' IDENTIFIED BY 'some_pass';
[Alternative Solutions for the Requirement]
[Background Information]
Applicable to scenarios with high security requirements, while also simplifying the DBA’s management of database user permissions.