Access denied for user 'root'@'192.168.56.56' (using password: YES) 問題排查


Access denied for user 'root'@'192.168.56.56' (using password: YES) 問題排查

報錯如下:
mysql -h192.168.56.56 -P3306 -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'192.168.56.56' (using password: YES)


上述報錯的可能原因: 
1.連接信息填寫錯誤(IP、PORT、USER、PASSWORD) 
檢查對應信息是否填寫錯誤。


2.網絡不通。 

可能網絡沒有調通或者存在防火牆,檢查IP和端口是否連通 
ping 192.168.56.56
telnet 192.168.56.56 3306


3.密碼過期或者用戶被鎖定。 

檢查用戶定義
mysql>  show create user 'root'@'%';
 

4.用戶定義了host,客戶端IP不在允許范圍內。 

檢查用戶定義
mysql>  show create user 'root'@'%';


5.MySQL配置了錯誤的bind_address,比如只允許本地登錄。

[root@localhost data]# grep 'bind_address' /etc/my.cnf 
bind_address='127.0.0.1'

[root@localhost data]# netstat -tpln |grep mysqld
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      18533/mysqld

示例中MySQL配置了綁定到127.0.0.1回環接口,無法通過其他IP訪問。配置文件中去掉這個配置並重啟MySQL即可。

 

Access denied for user 'root'@'192.168.56.56' (using password: YES) 問題排查
報錯如下:mysql -h192.168.56.56 -P3306 -uroot -p123456mysql: [Warning] Using a password on the command line interface can be insecure.ERROR 1045 (28000): Access denied for user 'root'@'192.168.56.56' (using password: YES)

上述報錯的可能原因: 1.連接信息填寫錯誤(IP、PORT、USER、PASSWORD) 檢查對應信息是否填寫錯誤。

2.網絡不通。 
可能網絡沒有調通或者存在防火牆,檢查IP和端口是否連通 ping 192.168.56.56telnet 192.168.56.56 3306

3.密碼過期或者用戶被鎖定。 
檢查用戶定義mysql>  show create user 'root'@'%'; 
4.用戶定義了host,客戶端IP不在允許范圍內。 
檢查用戶定義mysql>  show create user 'root'@'%';

5.MySQL配置了錯誤的bind_address,比如只允許本地登錄。
[root@localhost data]# grep 'bind_address' /etc/my.cnf bind_address='127.0.0.1'
[root@localhost data]# netstat -tpln |grep mysqldtcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN      18533/mysqld
示例中MySQL配置了綁定到127.0.0.1回環接口,無法通過其他IP訪問。配置文件中去掉這個配置並重啟MySQL即可。




免責聲明!

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



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