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

  • 相关阅读:
    在不给spring管理的类中获取类
    poi操作excel
    闭包
    输入url的过程发生了什么?
    跨域
    函数节流-防抖函数
    预解析-案例
    移动端适配方案
    实现元素水平居中和垂直居中的几种方法
    css小知识点
  • 原文地址:https://www.cnblogs.com/sankye/p/5662596.html
Copyright © 2011-2022 走看看