美文网首页
Mysql不支持远程连接:1130-Host 'xxx' is

Mysql不支持远程连接:1130-Host 'xxx' is

作者: garfieldkai | 来源:发表于2021-04-01 14:36 被阅读0次
    1. 在安装Mysql数据库的服务器上登陆root用户:
    mysql -u root -p
    
    image.png
    1. 切换数据库,查看user表中host信息
    use mysql;
    
    select host from user where user = 'root';
    
    image.png
    1. 将localhost修改为通配符%

    host列制定了允许用户远程登录的IP,指定为通配符%,表示不限制远程访问。

    注意:在生产环境下不能为了省事将host设置为%,这样做会存在安全问题,具体的设置可以根据生产环境的IP进行设置;

    update user set host = '%' where user = 'root';
    
    1. 执行flush privileges使配置生效
    flush privileges;
    

    相关文章

      网友评论

          本文标题:Mysql不支持远程连接:1130-Host 'xxx' is

          本文链接:https://www.haomeiwen.com/subject/prytkltx.html