如何修复此错误 [2045] 或此 [1054] 我尝试迁移时总是在终端中收到此消息 table

How to fix this error[2045] or this [1054] I always get this message in terminal when i try to migrate table

当我在终端中输入 php artisan migrate

我收到此错误编号 [2054],有时 [1054]

我试图更改 .env 文件

中的所有内容,例如 hostusernamepassword

database.phpconfig.php 文件,但效果不佳

Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from information_schema.tables where table_schema = lsapp and table_name = migrations)

at /Users/Ali/education/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|

错误提示您没有查询的权限。您需要使用密码 and/or 访问数据库必须有密码。

验证访问代码(用户、密码)或尝试通过 web 管理器访问,如 phpmyadmin、pgadmin 等...

最后,我通过下载 MySQL Workbench 然后在这个应用程序中创建一个新数据库得到了解决方案,它工作正常