-1

I'm installing Laravel homestead for the first time and have been stuck with the above issue and haven't been able to resolve it. The above issue arises when I execute the php artisan migrate:fresh --seed command in my Mac terminal after executing vagrant ssh and cd code. I have gone through all the websites and have granted privilege to my "root" localhost through my terminal as well as workbench and have made all the necessary changes to my .env file as well. The error still seems to persist and I have no idea how to go forward with it now. enter image description here

Any help would be much appreciated. Thank you.

h3t1
  • 1,126
  • 2
  • 18
  • 29
  • Does this answer your question? [QueryException SQLSTATE\[HY000\] \[1045\] Access denied for user 'homestead'@'localhost' (using password: YES)](https://stackoverflow.com/questions/44469647/queryexception-sqlstatehy000-1045-access-denied-for-user-homesteadlocalh) – MaryNfs Aug 15 '20 at 19:19
  • I have looked into that link before I posted my issue. I seem to be getting an error when I run php artisan cache:clear. This is the error - Predis\Connection\ConnectionException : Connection refused [tcp://127.0.0.1:6379] – Siddesh Sarathy Aug 16 '20 at 06:10
  • have you installed redis-server on your machine? – MaryNfs Aug 16 '20 at 07:29
  • Thank you for your response. I have solved the issue. Vagrant had an issue with access and permissions even though I had established them, which was generating the errors. So instead of running vagrant, I set up locally on my machine and now I can access my project. – Siddesh Sarathy Aug 16 '20 at 11:34
  • Check if you have granted permissions to your `root` user – Ankit Jindal Aug 16 '20 at 16:47

1 Answers1

0

The error means Laravel is trying to connect to the database with invalid credentials.

Whenever you make change to the .env file in Laravel you need to reset the cache. You need to run this command:

php artisan config:cache
Prince Dorcis
  • 955
  • 7
  • 7
  • I have run the command once I have made changes to the env file but the error still seems to persist. This is my .env file if it helps DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=sidtreiner DB_USERNAME=root DB_PASSWORD=anuradha – Siddesh Sarathy Aug 16 '20 at 06:04
  • Are you able to open the database in your Workbench. Also Try to run the command with `-v` as suggested in the error to have details. – Prince Dorcis Aug 16 '20 at 10:25
  • Thank you for your response. Yes I was able to open the database on workbench and through the terminal as well. However,I have solved the issue. Vagrant had an issue with access and permissions even though I had established them, which was generating the errors. So instead of running vagrant, I set up locally on my machine since I'm going to be running only a single Laravel project. – Siddesh Sarathy Aug 16 '20 at 11:36