Search code examples
phplaravelmigrationartisan-migrate

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


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|


Solution

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