mysql+error+code+1130_mysql(errorCode:1130)远程连接 Host '*' is not allowed to connect to this MySQL se...

mysql不支持远程连接,报错误: ERROR 1130: Host * is not allowed to connect to this MySQL server

解决方法:将localhost修改为%

1、登录mysql(Linux系统)

mysql -u root -p 密码

2、选择mysql数据库

mysql> use mysql;

3、 查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称)

mysql> select host from user where user='root';

+-------------------------+

| host |

+-------------------------+

| 127.0.0.1 |

| ::1 |

| iz2zeiqn00z9x5tiobhi08z |

| localhost |

+-------------------------+

4 rows in set (0.00 sec)

4、更改“mysql”数据库里的“user”表里的“host”项,从”localhost”改为'%'。

update user set host='%' where user='root';

修改host值(以通配符%的内容增加主机/IP地址,当然也可以直接增加某个特定IP地址,如果执行update语句时出现ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY' 错误,需要select host from user where user = 'root';

查看一下host是否已经有了%这个值,如果有了直接执行下面的flush privileges;即可)

5、重新加载权限

mysql> flush privileges;

6、查看权限

mysql> select host,user from user where user='root';

+-------------------------+------+

| host | user |

+-------------------------+------+

| % | root |

| 127.0.0.1 | root |

| ::1 | root |

| iz2zeiqn00z9x5tiobhi08z | root |

+-------------------------+------+

4 rows in set (0.00 sec)

mysql> quit;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值