2018年6月11日 星期一

處理mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication

想用PHP自己寫一個功能撈cdr的記錄,但連接Elastix2.5的資料庫時發生下面的錯誤

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

上網查了一下這是mysql密碼編碼是舊版的關係
使用下列sql查出所有帳號密碼長度
select user, length(password) from mysql.user;
如果清單列出來長度41是新編碼方式,16是舊編碼方式

再來使用下列sql變更密碼格式
set old_passwords=FALSE;
set password for 'root'@'%' = password('XXXX');
flush privileges;

之後更新頁面應該可以了

沒有留言:

張貼留言