Why can’t I migrate to my database? The .env configuration is correct and I created a model in addition to creating the database in phpMyAdmin.
php artisan migrate
When I run the migrate command I get the following error:
IlluminateDatabaseQueryException : SQLSTATE[HY000] [1045] Access
denied for user ‘homestead’@’localhost’ (using password: YES) (SQL:
select * from information_schema.tables where table_schema = homestead
and table_name = migrations)
2
Answers
This error basically comes from the after changes in the .env file. Whenever we change the
DB_DATABASE
,DB_USERNAME
andDB_PASSWORD
in .env file, we need to clear the cache.After completion of .env edit, enter this command in your terminal for clear cache:
php artisan config:cache
Also, If you are using the PHP’s default web server (eg.
php artisan serve
) you need to restart your server after changing your .env file values.very easy my friend go to your .env file and edit this line to your password
and do