詭異的 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>

成功登錄了。原因居然是密碼里含有$符號。特殊字符需要慎用,用不好就把自己給坑了。不過密碼有$符號,並不影響它在腳本,程序里的使用。$的特殊性應該和系統命令有關。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM