zoukankan      html  css  js  c++  java
  • 解决ERROR 1130: Host '192.168.11.1' is not allowed to connect to this MySQL

    使用navicat进行远程登录MySQL时,报出

     ERROR 1130: Host '192.168.11.1' is not allowed to connect to this MySQL  server

    解决方法:需要修改mysql数据库下的user表user=root的host字段的值,将localhost改为%

    首先在mysql安装机器上登录mysql,

    >>提君博客原创  http://www.cnblogs.com/tijun/  <<

    然后切换到mysql 数据库下

    提君博客原创

    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> show tables
        -> ;
    +---------------------------+
    | Tables_in_mysql           |
    +---------------------------+
    | columns_priv              |
    | db                        |
    | event                     |
    | func                      |
    | general_log               |
    | help_category             |
    | help_keyword              |
    | help_relation             |
    | help_topic                |
    | host                      |
    | ndb_binlog_index          |
    | plugin                    |
    | proc                      |
    | procs_priv                |
    | servers                   |
    | slow_log                  |
    | tables_priv               |
    | time_zone                 |
    | time_zone_leap_second     |
    | time_zone_name            |
    | time_zone_transition      |
    | time_zone_transition_type |
    | user                      |
    +---------------------------+
    23 rows in set (0.00 sec)

    查看user表中的内容

    mysql> select host,user from user;
    +------------+------+
    | host       | user |
    +------------+------+
    | 127.0.0.1  | root |
    | localhost  |      |
    | localhost  | root |
    | ltt5.bg.cn |      |
    | ltt5.bg.cn | root |
    +------------+------+
    5 rows in set (0.00 sec)

    这里就可以看到,root用户目前只允许在localhost下登录

    提君博客原创

    修改

    mysql> update user set host = '%' where user = 'root';
    ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'
    mysql> flush privileges;
    Query OK, 0 rows affected (0.00 sec)

    中间会报出一个ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'

    不用管,执行flush privileges;即可

    再次查询user表

    mysql> select host,user from user;
    +------------+------+
    | host       | user |
    +------------+------+
    | %          | root |
    | 127.0.0.1  | root |
    | localhost  |      |
    | ltt5.bg.cn |      |
    | ltt5.bg.cn | root |
    +------------+------+
    5 rows in set (0.00 sec)

    到这里,你可以在navicat上再次连接mysql,就可以成功了。

    提君博客原创

    >>提君博客原创  http://www.cnblogs.com/tijun/  <<

     
  • 相关阅读:
    mysql-5.7.15-winx64免安装版配置
    db2 表授权语句
    java 调用 .net webservice 示例
    打印内存高解决方案
    eclipse快捷键调试总结【转】
    DevExpress GridControl 自定义 summary 算法
    GEMR: Get the parent window for view
    弹出窗口
    WPF UI虚拟化
    WPF应用程序最小化到系统托盘
  • 原文地址:https://www.cnblogs.com/tijun/p/7575202.html
Copyright © 2011-2022 走看看