0

I've been following along with Laracasts Laravel 5 from Scratch series, and have run into a snag with Episode 7: Fetching Data. Playing around myself, I found that changing the DB settings in my .env file let me connect to my MySQL server, but the tutorial calls to use SQLite, so I thought it'd be neat to learn a bit about it (having never used it before). I followed along exactly (though the tutorial changes the config/database.php file instead of the .env), but when I got to the part to display my cards, I get the following error:

SQLSTATE[HY000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

I don't know why Laravel is trying to make a MySQL connection. I've changed the .env file, removing all all the lines starting with DB_ except DB_CONNECTION, changing it to sqlite. I also tried removing DB_CONNECTION from .env. In the config/database.php, I changed DB_CONNECTION to sqlite as well (the tutorial does this).

I've tried running php artisan cache:clear, stopping and starting the artisan server, and so far, nothing.

If I use the model created along with the tutorial in php artisan tinker, I am able to insert/get data.

Something like this database to use seems straight forward, and given I have projects where I use multiple databases, if I can't even get/understand this, I'm worried about more complex things with Laravel.

Rohit
  • 3,018
  • 2
  • 29
  • 58
  • Usually means the password you are using is wrong. – jhmckimm Aug 23 '16 at 15:51
  • http://stackoverflow.com/questions/29756194/access-denied-for-user-homesteadlocalhost-using-password-yes check this . You may need to restart your server . follow all steps. – Abhishek Chaurasia Aug 23 '16 at 15:54
  • I didn't even realize SQLite could use a password; I thought given it's a local flat file, no pass was necessary; it's not even an option in the config. As for the restarting server and cache Abhishek, as mentioned in the OP, I tried that. In fact, I saw that post specifically; it didn't work. So far, only restarting my computer has worked. – Rohit Aug 24 '16 at 04:37

0 Answers0