MySQL远程连接报错1045,无权限问题(本地能连接,使用IP地址无法连接)

原因:MySQL默认是没有开启远程连接权限,所以无法使用IP地址连接

方法:授予MySQL远程连接权限

1.在MySQL的bin目录下,打开cmd窗口;

2.登录MySQL:mysql -uroot -p

3.grant all privileges on *.* to '用户名'@'IP地址' identified by '密码';(给特定ip授权)

eg:grant all privileges on *.* to 'root'@'IP地址' identified by '密码';

  grant all privileges on *.* to root@"%" identified by '密码' with grant option;  (任意ip都能远程连接)

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

4.刷新;

 flush privileges;

5.重启MySQL服务。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值