本文实例讲述了mysql设置指定ip远程访问连接的方法,分享给大家供大家参考。具体实现方法如下:
1. 授权用户root使用密码jb51从任意主机连接到mysql服务器:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'jb51' WITH GRANT OPTION;
flush privileges;
flush privileges;
2.授权用户root使用密码jb51从指定ip为218.12.50.60的主机连接到mysql服务器:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'218.12.50.60' IDENTIFIED BY 'jb51' WITH GRANT OPTION;
flush privileges;
flush privileges;
GRANT ALL PRIVILEGES ON *.* TO abc@'192.168.2.%' 即可。
GRANT ALL PRIVILEGES ON *.* TO abc@'192.168.%' 即可。
或者
GRANT ALL PRIVILEGES ON *.* TO abc@'192.168.%' 即可。'192.168.0.0/255.255.0.0'
GRANT ALL PRIVILEGES ON *.* TO abc@'192.168.%' 即可。
或者
GRANT ALL PRIVILEGES ON *.* TO abc@'192.168.%' 即可。'192.168.0.0/255.255.0.0'