php連接mysql報錯The server requested authentication method unknown to the client


php7.0連接mysql8.0報錯:The server requested authentication method unknown to the client

是因為mysql80使用了新的密碼驗證插件:caching_sha2_password,而在php7.0並不支持這種方式。

解決辦法:

​ 1.升級php

​ 2.修改mysql的配置文件,my.ini

​ 找到mysqlId下的default-authentication-plugin配置項修改其值為mysql_native_password

重啟mysql即可。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM