MySQL限制IP網段範圍從遠端訪問的方法

chenfeng發表於2017-03-15
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';

上面的語句表示將test資料庫的所有許可權授權給test這個使用者,只允許test使用者在192.168.8/9/20這三個網段的IP範圍進行遠端登陸,並設定test使用者的密碼為123456

重新整理許可權表使其設定生效:
mysql> flush privileges;



來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2135384/,如需轉載,請註明出處,否則將追究法律責任。

相關文章