Mysql远程访问权限设置

grant all privileges on *.* to '创建的用户名' @"%" identified by '密码';

比如我的账号是root,密码为1234

grant all privileges on *.* to 'root' @"%" identified by '1234';

@ 后面是访问mysql的客户端ip地址(或是 主机名) % 代表任意的客户端,如果填写 localhost 为

本地访问(那此用户就不能远程访问该mysql数据库了)

二、授权让ip地址为 x.x.x.3用户可以访问

grant all privileges on *.* to '账号'@'x.x.x.3' identified by '密码';

修改完成之后,刷新权限

flush privileges

三、扩展

如果是连linux上的mysql服务,可能还会被linux防火墙拦截

执行

service iptables stop

查看防火墙状态

service iptables status

猜你喜欢

转载自blog.csdn.net/QingXu1234/article/details/113662966