zoukankan      html  css  js  c++  java
  • 诡异的 ERROR 1045 (28000): Access denied for user 错误

    问题描述:

    用户已建,权限已赋予。long long ago这个用户是可以正常访问的,但是今天它就不能访问了。报错如下:

    ERROR 1045 (28000): Access denied for user 'lf'@'172.17.215.11' (using password: YES)

    排障过程: 

    select user,host,password  from mysql.user;
    ….
    | lf| localhost     | *5A4CAF734551B5347FEC1171CEB89D503693C1B4 |
    +--------------+---------------+-------------------------------------------+
    select password(‘LF98$xxi’);
    +-------------------------------------------+
    | password('LF98$xxi')                      |
    +-------------------------------------------+
    | *5A4CAF734551B5347FEC1171CEB89D503693C1B4 |
    +-------------------------------------------+
    1 row in set (0.05 sec)
    

     但是登录就是报错

    [root@vhost02 ~]# mysql -ulf -pLF98$xxi 
    Warning: Using a password on the command line interface can be insecure.
    ERROR 1045 (28000): Access denied for user 'lf'@'localhost' (using password: YES)
    

    难道是权限没有刷新?

    [root@vhost02 ~]# mysql -uroot -p
    ...
    mysql>flush privileges;
    

    重新登录仍然失败。。。

     

    最终解决方式:

    就在小编半晕半醒之间忽然灵光一现,用户名和密码分开输入吧,于是:

    [root@vhost02 ~]# mysql -ulf -p 
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 180
    Server version: 5.6.25-log MySQL Community Server (GPL)
    Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
    Oracle is a registered trademark of Oracle Corporation and/or its
    affiliates. Other names may be trademarks of their respective
    owners.
    Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
    mysql>
    

    成功登录了。原因居然是密码里含有$符号。特殊字符需要慎用,用不好就把自己给坑了。不过密码有$符号,并不影响它在脚本,程序里的使用。$的特殊性应该和系统命令有关。

  • 相关阅读:
    resultMap之collection聚集
    try{}catch{}finally{}使用总结
    动手动脑兼课后作业2
    第一个psp0级
    原码反码补码
    动手动脑兼课后作业
    第七周进度报告
    第六周进度报告
    第五周进度报告
    《大道至简》读后感
  • 原文地址:https://www.cnblogs.com/janehoo/p/5631140.html
Copyright © 2011-2022 走看看