php - Laravel: SQLSTATE[HY000] [2054] 服务器请求客户端未知的身份验证方法

标签 php mysql laravel laravel-artisan migrate

安装新的 laravel 应用程序 5.7 并尝试迁移后出现此错误:

Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = xxx_db and table_name = migrations)

at C:\xampp\htdocs\xxxxx\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664 660| // If an exception occurs when attempting to run a query, we'll format the error 661| // message to include the bindings with SQL, which will make this exception a 662| // lot more helpful to the developer instead of just the database's errors. 663| catch (Exception $e) {

664| throw new QueryException( 665| $query, $this->prepareBindings($bindings), $e 666| ); 667| } 668|

Exception trace:

1 PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]") C:\xampp\htdocs\xxxxx\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70

2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=xxx_db ", "root", "**********", []) C:\xampp\htdocs\xxxxx\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70

Please use the argument -v to see more details.

最佳答案

这个查询解决了我的问题。

 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root@123';

关于php - Laravel: SQLSTATE[HY000] [2054] 服务器请求客户端未知的身份验证方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53607322/

相关文章:

mysql - 数据库 :migrate produces no error and does not create table in database (MYSQL)

mysql - SQLException: 找不到合适的驱动程序

php - 表单 - 从 Controller 传递数组到 View - PHP - Laravel

mysql - 如何将 dynemodb 与 lumen 或 laravel 一起使用

php - 比较四个字符的字符串时,有什么简单的方法可以检查两个或多个字符是否相等?

php - 在 YII 中使用 ffmpeg 从 mp4 视频中获取图像

javascript - 使用 PHP 实现多个谷歌地图标记

c# Entity Framework 抛出异常但不回滚数据库

mysql - SQL GROUP BY来自两列的计算值

php - jQuery UI 可排序 php/mysql