首頁 > php教程 > PHP开发 > 主體

PHP5連接Mysql5的認證協定問題

高洛峰
發布: 2016-12-02 14:00:21
原創
1478 人瀏覽過

MYSQL 4.1以後, 採用了一種新的用戶認證協議, 對於老的客戶端會出現不支持認證協議的錯誤, 以下是官方網站的解決方法? 

1Upgrade all client programs to use a 4.1.1 或newer client library. 

更新客戶端庫,這需要更新PHP的擴充庫,對於老的api PHP已經不提供了這樣的擴充庫了 

2When connecting to the server with a pre-4.1 client program, client program account that still has a pre-4.1-style password. 

使用先前建立的帳號連接,對於在新的認證協議下建立的帳戶就不行了 

3Reset the password to pre-4.1 style for each user
3Reset the password to pre-4.1 style for each user that ne to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD_PASSWORD() function: mysql> SET PASSWORD FOR 

-> 'some_user'@'some_host' = OLD_PORD); Alternatively, use UPDATE and FLUSH PRIVILEGES: mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd') -> WHERE Host = 'some_host' AND you want to use for ``newpwd'' in the preceding examples. MySQL cannot tell you what the original password was, so you'll need to pick a new one. 

這是一個不錯的辦法,新建立的帳號採用老式的加密協定 

4Tell the server to use the older password hashing algorithm: 

Start mysqld with the --old-passwords option. 

這樣新認證協定的優點就沒法使用了password to each account that has had its password updated to the longer 4.1 format. You can identify these accounts with the following query: mysql> SELECT Host, User, Password FROM mysql.user 


For each account record displayed by the query, use the Host and User values and assign a password using the OLD_PASSWORD() function and either SET PASSWORD or UPDATE, as described lier . 

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門推薦
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板