在centos7.5上安裝了php7.3,laravel5.7,mysql8.0,運(yùn)行php artisan migrate的時(shí)候,出現(xiàn)如下錯(cuò)誤: Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations)百度到的解決辦法:刪除創(chuàng)建的用戶和授權(quán),變?yōu)樵瓉淼尿?yàn)證方式,然后從新創(chuàng)建用戶并授權(quán)即可:找到mysql配置文件并加入:default_authentication_plugin=mysql_native_password或mysql -uroot -puse mysql;ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '你的密碼';問題:百度到的解決方式是退到以前的驗(yàn)證方式,如果要使用新的驗(yàn)證方式該怎么辦呢?
1 回答

慕勒3428872
TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超6個(gè)贊
應(yīng)該是php連接數(shù)據(jù)庫是默認(rèn)用mysql_native_password的認(rèn)證方式,在php代碼里指定caching_sha2_password認(rèn)證方式試試
添加回答
舉報(bào)
0/150
提交
取消