在萬網虛擬主機上連線資料庫出錯mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication
阿新 • • 發佈:2019-02-19
PHP網站上傳到萬網的虛擬空間後,按照萬網提供的資料庫連線資訊,但是卻一直連不上資料庫。後來,我直接寫了個只包含資料庫連線的簡單PHP檔案,執行,才得到完整的報錯資訊:
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
經搜尋,找到了解決的辦法,通過navicat for mysql連線資料庫,在命令列執行下面的語句:
SET SESSION old_passwords = FALSE;
SET PASSWORD = PASSWORD('your existing password in plain text');
再次執行連線資料庫的指令碼,能夠正常連線資料庫了。
另外,萬網的IIS竟然不支援PHP 函式empty。