Get the App
SLTechnology News&Howtos  ›  Database  › 

The method of MySQL restricting the range of IP Network Segment from remote access

Shulou Source: shulou.com Published: 2022-06-01 06:14:12 12月02日 Update

Mysql > grant select,insert,update,create on test.* to test@'192.168.8.%' identified by '123456'

Mysql > grant select,insert,update,create on test.* to test@'192.168.9.%' identified by '123456'

Mysql > grant select,insert,update,create on test.* to test@'192.168.20.%' identified by '123456'

The above statement authorizes all permissions of the test database to the test user, only allows the test user to log in remotely in the IP range of the three network segments 192.168.8 and 920, and sets the password of the test user to 123456

Refresh the permissions table to make its settings take effect:

Mysql > flush privileges

Tags: User permission network segment scope three password data database statement face login method restriction Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL Apple NVidia Redmi