美文网首页
Centos系统安装mysql使用navicat连接不上问题

Centos系统安装mysql使用navicat连接不上问题

作者: 一觉睡到丶小时候 | 来源:发表于2023-08-10 09:13 被阅读0次

    登陆到数据
    mysql -uroot -p密码

    use mysql;
    select host,user,password from user;

    可以看到 user 为 root,host 为 localhost 的话,说明 MySQL 只允许本机连接,那么外网,本地软件客户端就无法连接了。

    解决方案:

    执行如下命令:

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

    mysql> use mysql
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A
    
    Database changed
    mysql> update user set host='%' where user ='root';
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)
    
    

    查看是否修改正常:

    mysql> select host,user from user;
    +-----------+---------------+
    | host      | user          |
    +-----------+---------------+
    | %         | root          |
    | localhost | mysql.session |
    | localhost | mysql.sys     |
    +-----------+---------------+
    3 rows in set (0.00 sec)
    
    mysql> 
    
    

    相关文章

      网友评论

          本文标题:Centos系统安装mysql使用navicat连接不上问题

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