2011-08-12 36 views
0

我有問題從PHP 5.3.5(WAMP安裝)連接到MySQL 5.5.8。我收到以下錯誤:mysqlnd無法連接到MySQL 4.1+使用舊的不安全身份驗證

mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. 
Please use an administration tool to reset your password with the command 
SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and 
more secure, hash value in mysql.user. If this user is used in other scripts 
executed by PHP 5.2 or earlier you might need to remove the old-passwords flag 
from your my.cnf file 

我已經試過每一個建議,我可以在網上找到,包括堆棧溢出幾個和這一個:http://engin.bzzzt.biz/2010/11/12/php-mysql-insecure-authentication/

我檢查了我的設置與舊密碼標誌已關閉。我已將密碼更新爲新密碼哈希,並驗證了用戶表中的哈希值爲41個字符,並且刷新了特權。出於某種原因,我仍然收到錯誤。有人有主意嗎?

更新:我正在使用ZenCart。這是我的連接被製成,其中被拋出該錯誤的行:

$this->link = @mysql_connect($zf_host, $zf_user, $zf_password, true) or die (mysql_error());

+1

顯示您的連接代碼。請記住隱藏用戶名/密碼/主機名。 –

+0

@Marc B - 不幸的是我不認爲代碼會有很大的幫助。我在一個繼承的項目的特定實例中使用ZenCart。我已經更新了我正在建立連接的那一行的帖子。 – Luke

+0

也許這個:http://engin.bzzzt.biz/2010/11/12/php-mysql-insecure-authentication/ –

回答

0

想通了!對我來說是一個疏忽。顯然,在ZenCart中有2個文件需要設置數據庫配置。一個用於目錄,另一個用於管理區域。由於它們都連接到相同的數據庫,因此對我來說沒有太多意義。也許這與能夠使用一個數據庫用戶的目錄和一個用於管理員出於安全原因有關。我只是設置了一個本地副本並更改了其中一個配置文件而不更改其他配置文件。導致問題的文件仍然指向我的生產數據庫。知道它必須是簡單的東西!

+0

相關:http://stackoverflow.com/q/10420831/1031312 – Ozzy

3

連接到MySQL使用有問題的用戶,執行以下命令客戶端:

SET old_passwords=0; 
SET password=PASSWORD('your current password'); 
相關問題