zoukankan      html  css  js  c++  java
  • mysql远程连接报错: Host * is not allowed to connect to this MySQL server,解决方法

    localhost改成%

    1.进入mysql的BIN目录

    注:root为管理员用户名,password为用户root的密码:

    mysql -u root -p password

    mysql>use mysql;

    mysql>update user set host ='%'where user ='root' and host ='localhost';

    mysql>flush privileges;

    注:这时候连接此服务器的mysql客户端需要重新启动下,然后再连接此服务器。

    mysql> select host,user,password from user;
    +-----------------------+------+-------------------------------------------+
    | host                  | user | password                                  |
    +-----------------------+------+-------------------------------------------+
    | localhost             | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
    | localhost.localdomain | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
    | 127.0.0.1             | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
    | ::1                   | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 |
    | localhost             |      |                                           |
    | localhost.localdomain |      |                                           |
    +-----------------------+------+-------------------------------------------+
    6 rows in set (0.00 sec)
    
    mysql> update user set host ='%'where user ='root' and host ='localhost.localdomain';
    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> 
  • 相关阅读:
    Spring-MVC
    Spring与MyBatis整合(哇,快来看,他写的真好,简单易懂哎)
    Spring事务终极版...
    JdbcTemplate(增删改查以及以注释实现增删改查)
    AOP进阶
    MyBatis增删改查
    JSP的数据交互
    JSP数据交互
    JSP中9大内置对象
    动态网页开发基础
  • 原文地址:https://www.cnblogs.com/sunlong88/p/9097312.html
Copyright © 2011-2022 走看看