How to grant remote access to MySQL for a whole subnet?

前端 未结 7 1706
不知归路
不知归路 2020-12-02 07:50

I can easily grant access to one IP using this code:

$ mysql -u root -p
Enter password:    
mysql> use mysql    
mysql> GRANT ALL ON *.* to root@\'192.         


        
相关标签:
7条回答
  • 2020-12-02 08:35

    Motivated by @Malvineaus answer I tried it myself and noticed that it didn't work for me.

    You can specify subnet masks with '192.168.1.%' or '192.168.1.0/255.255.255.0' but the subnet must always be on complete octets. see https://mariadb.com/kb/en/create-user/#host-name-component. As result the functionality between one way of specification and the other is the same.

    For example '192.168.1.0/255.255.255.128' will not work as it is not on a complete octet boundary.

    0 讨论(0)
提交回复
热议问题