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

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

问题描述:

when I type php artisan migrate in terminal

I get this error number [2054] and sometimes [1054] !

I tried to change everything like host, username and password in .env file

database.php and config.php file, but it didn't work well

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|

Finally, I got the solution by downloading MySQL Workbench then create a new database in this app , and it's working fine

The error says you do not have permission to do queries. You need to access with the password and/or the database must have a password.

Verify the access codes (user, password) or try to access by a web manager, like phpmyadmin, pgadmin, etc ...