如何解決 larave 在 mysql 8 報錯 SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select from information_schema.tables where table_schema = and table_name
做爲一個好奇猿,最近新項目中使用了 MySQL 8.0 版本,安裝過程都很順暢,滿心期待着週五的時候,結果上線時報了上面的錯。緣由在於 MySQL 8.0 驗證插件作了變更,致使默認加密方式有變動,具體變更能夠參考 https://dev.mysql.com/doc/rel...html
具體解決步驟能夠參考以下步驟 (讓咱們手拉手,摸着石頭過河):mysql
修改 MySQL 配置文件中的驗證插件類型並重啓 MySQLsql
[mysqld]
default_authentication_plugin= mysql_native_password
若是以前已經建立過對應的 user,建議使用以下 SQL 從新建立, 其中 {} 的內容你們能夠根據實際狀況進行替換微信
CREATE USER '{user}'@'{localhost}' IDENTIFIED WITH mysql_native_password BY '{password}';
最後推薦有課學微信公衆號,有課學是一站式的課程返現 + 好課推薦平臺。但願你們都能【學好課,有課學,學有所獲】。加密