close
如果你有安裝MySQL
而且MySQL版本是5.X的,請注意囉

因為從MySQL 4.1開始,密碼格式很像變得不同囉
詳情請看此篇:http://dev.mysql.com/doc/refman/4.1/en/old-client.html

MySQL 4.1 and up uses an authentication protocol based on a password hashing algorithm that is incompatible with that used by older clients. If you upgrade the server to 4.1, attempts to connect to it with an older client may fail with the following message:
shell> mysql Client does not support authentication protocol requested by server; consider upgrading MySQL client


簡單的說,MySQL 4.1跟更新的版本使用一個以密碼雜湊演算法為基礎的驗證協定,而且跟舊版的不一樣,不適用於舊版的Client端.
如果你的MySQL升級到4.1(或者更新的,像是5.X),你連線到MySQL時應該會出現以下訊息(請往上看XD)
解決方法很多
  • 升級Client端的MySQL函式庫
  • 連線到4.1以上版本的MySQL時,使用4.1以上版本的帳號密碼來進行連線
  • 啟動MySQL時,多加個--old-passwords引數(待會說明)
  • 登入MySQL,使用old_password函式(待會說明)
OK,我們先來學第四個方法吧.. 也是我最習慣使用的方法(因為簡單拉@@")

請你先登入mysql(請用有權限更改mysql的帳戶,例如:root)
然後↓

mysql> set password for '帳號'@'主機' = old_password('密碼');
Query OK, 0 rows affected (0.00 sec)

用好之後,請update跟flush privileges

mysql> update mysql.user set password = old_password('密碼') where host = '主機' and user = '帳號';
Query OK, 0 rows affected (0.01 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

OK,這樣一來就更改好了!可以連線看看囉!

另外一種方法,也就是第三種方法可以自行參考MySQL函式庫說明囉^^

arrow
arrow
    全站熱搜

    hechian 發表在 痞客邦 留言(2) 人氣()