zoukankan      html  css  js  c++  java
  • mysql 远程访问权限

    use mysql;

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

    select host, user from user; flush privileges;

    出错不管他 

    mysql> select host ,user from user;
    +-----------+------------------+
    | host | user |
    +-----------+------------------+
    | % | admin |
    | % | root |
    | 127.0.0.1 | root |
    | ::1 | root |
    | localhost | debian-sys-maint |
    | ubuntu | root |
    +-----------+------------------+

    关键是这一行:| % | root | %

    表示可以允许任何机器访问。

    此时远程还是连不上。

    然后查看3306端口情况

    使用nestat命令查看3306端口状态:

    ~# netstat -an | grep 3306

    tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN

    从结果可以看出3306端口只是在IP 127.0.0.1上监听,所以拒绝了其他IP的访问。

    解决方法:修改/etc/mysql/my.cnf文件。打开文件,找到下面内容:

    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    bind-address  = 127.0.0.1

  • 相关阅读:
    C# 数据权限缓存
    .net core平台使用遇到的坑
    @RenderBody @RenderPage @RenderSection
    _ViewStart.cshtml介绍
    Git中的AutoCRLF与SafeCRLF换行符问题
    select fotr update
    索引的区分度
    索引最左匹配原则
    mysql索引相关知识
    锁-乐观锁和悲观锁
  • 原文地址:https://www.cnblogs.com/sankye/p/5662596.html
Copyright © 2011-2022 走看看