远程MySQL连接范围IP

时间:2012-08-03 04:48:39

标签: mysql

我想设置一个可以从IP访问mysql的远程mysql用户(192.168.1.100~192.168.1.255)。

我尝试了以下命令:

GRANT select ON *.* TO 'uname'@'192.168.1.%'  IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

问题是它允许IP从192.168.1.1到192.168.1.99。

所以我尝试了这个:

GRANT select ON *.* TO 'uname'@'192.168.1.100/25'  IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

结果相同。有什么建议吗?

非常感谢!

1 个答案:

答案 0 :(得分:2)

GRANT select ON . TO 'uname'@'192.168.1.1__' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
GRANT select ON . TO 'uname'@'192.168.1.2__' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;