zoukankan      html  css  js  c++  java
  • MySQL error 1045(28000): Access denied for user ...

    Problem

    I have a database called hibernate in my MySQL server and I grant privileges to a user using this command
        > grant all on hibernate.* to 'testuser'@'%' identified by 'testuser';
    Wildchar % means no matter where the user logs in mysql server from, the access should be allowed for further checking/verification.
    When I tried to log in as the newly created user from local host, I got this error:
        ERROR 1045 (28000): Access denied for user 'testuser'@'localhost' (using password: YES)
    Also I tried some suggested solutions:
       > FLUSH PRIVILEGES:
       > SET PASSWORD FOR 'testuser'@'%'='testuser';
    None of them works.

    My solution:
    Using following two commands:
       > grant all on hibernate.* to 'testuser'@'%' identified by 'testuser';
       > grant all on hibernate.* to 'testuser'@'localhost' identified by 'testuser';

    Theoretically, wildchar % should have included all hosts. But it may not cover localhost. Who knows

  • 相关阅读:
    python迭代器
    初识html
    跨域(jsonp)方法
    闭包
    pycharm软件配置
    插槽slot
    git常用操作
    在mac中使用Charles抓包操作
    防止网页被嵌入框架
    H5唤起APP
  • 原文地址:https://www.cnblogs.com/SophiaTang/p/2296512.html
Copyright © 2011-2022 走看看