Mysql允许远程连接的方式--及更新原有设置(限制访问IP段)

##切换数据库

use mysql;

##查看user及Host信息

select User,Host from user;

#添加允许远程连接的用户及地址,例如只允许192.168.130-139段的IP访问

grant all privileges on *.* to root@"192.168.1.13%" identified by 'tfedu6188' with grant option;

##更新之前允许为全部的连接用户

UPDATE `user` SET `Host` = '192.168.1.10%' where `Host` = '%';
##刷新规则

flush privileges;

##退出
exit


posted @ 2021-04-13 10:35  PIOUT  阅读(375)  评论(0)    收藏  举报