我在CentOS 6.x服務器上運行MySQL Server 5.1.73。 我已經爲root用戶設置了密碼。 當我指定下面的命令時,它會將我登錄到mysql shell。連接MySQL與主機名和密碼時的奇怪行爲
[[email protected] ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 60384
我檢查了主機名
mysql> SELECT @@hostname;
+-------------------------+
| @@hostname |
+-------------------------+
| sandbox.hortonworks.com |
+-------------------------+
現在我loggoff並嘗試與指定主機名明確登錄,並要求我提供它拋出拒絕訪問錯誤的密碼。
[[email protected] ~]# hostname -f
sandbox.hortonworks.com
[[email protected] ~]# mysql -u root -p -h sandbox.hortonworks.com
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'sandbox.hortonworks.com' (using password: YES)
即使陌生人部分: 我使用相同的命令,但除去-p參數(即,使用密碼=假),它記錄在成功而不詢問口令。
[[email protected] ~]# mysql -u root -h sandbox.hortonworks.com
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 61736
任何人都可以告訴我是否缺少任何配置?
問候, -JE