2016年8月10日 星期三

PHP連線MySQL出現「cannot connect to MySQL 4.1+ using the old insecure authentication」

使用php-mysqlnd連線mysql,出現以下錯誤訊息:
Connect failed: mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication.

原因判斷:
mysql舊的密碼Hash長度為16,新的密碼Hash長度則為41
php-mysqlnd 5.3以上版本使用的連線密碼格式為MySQL 4.1+,故進行mysql連線會出現不支援舊的密碼Hash格式訊息。

排除方法:
方法一
1.編輯 /etc/my.cnf
2.移除 old_passwords = 1
3.重新啟動 mysql
方法二
執行以下SQL語法
SET old_passwords = 0;
SET PASSWORD FOR 'User'@'Host'=PASSWORD('password');
FLUSH PRIVILEGES;

沒有留言:

張貼留言

Ubuntu 使用apt-get -y update更新出現大量Failed to fetch 404 Not Found訊息

Ubuntu 使用apt-get -y update更新出現大量Failed to fetch 404 Not Found訊息,確認DNS可以解析網址也可連到網路,基本可排除網路問題。 原因判斷:Ubuntu版本過舊,其更新包路徑已不在原本sources.list檔案內的更新路徑...