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