1

I have been creating a Laravel 5.2 application and everything was working perfectly until this morning. Now, when I try to login to the laravel app like I did yesterday at localhost:8888/login, I get this: PDOException in Connector.php line 55: SQLSTATE[28000] [1045] Access denied for user 'homestead'@'localhost' (using password: YES)

There was an OSX 10.10.5 security update 2016-002 that was installed and required a restart. I think this is the only thing that changed between it working and not working. It's apparently too soon to see the details of that update on the apple site.

My .env file looks like this:

APP_ENV=local
APP_DEBUG=true
APP_KEY=0ag8zA7SD5JRSmQTmVOpteTx82lIZF3n
APP_URL=http://localhost:8888

DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_lic
DB_USERNAME=root
DB_PASSWORD=root

I searched the web and StackOverflow for answers and have tried the following:

  1. php artisan config:clear to clear the config
  2. Restarted the server by ^C in the terminal window where the server was started and then started it again with php -S localhost:8888 -t public
  3. Restarted the MySQL server using the OSX System Preferences panel like usual.
  4. Checked the connection using php artisan tinker and entering DB::connection()->getDatabaseName() which resulted in "laravel_lic"
  5. Checked the Config database username with Config::get('database.connections.mysql.username') in tinker which resulted in "root"
  6. ran php artisan migrate:reset which successfully rolled back all the migrations, then ran php artisan migrate which successfully migrated the tables and verified using the database panel in PHPStorm as I have been doing since I started the project.
  7. Did a text search in the entire project for the word 'homestead' and the only results were in the git ignore file.
  8. I ran composer update which updated some Symfony stuff.

I'm NOT using homestead.

I also did NOT do anything related to the unix_socket. I hadn't heard of it until searching for answers to this question and don't see any settings for it so I doubt there could be an issue there.

I have been trying things for the last few hours, many more than once (such as restarting the server) so I'm doubtful the order of doing things could be a cause.

Is anyone else having this issue? Are there any other things I should try to get it working again?

UPDATE 4/1/2016

After fighting this for a long time without any progress on knowing what the problem could be, I decided to create a fresh Laravel install and recreate the site bit by bit, testing all along the way. The good news is, I now have my site up and running and have continued development. The bad news is, I was just copying over the new files and testing as I went. Nothing was changed from one site to the other. I wish I had a real "answer" for this issue but if nothing else, I've compiled the extensive research and troubleshooting steps I went through for someone else to try who comes across the same issue.

I still have the problem site in it's folder so if anyone does have other things to try or if I find a real answer to why this was happening, I'll post it.

  • As a last ditch effort, I restarted my computer and now I can't even get to the login screen. Any page I try to access shows Be Right Back. I've tried `php artisan up` a number of times and there is no error - it says it's live. I restarted again and same result... ugh. – Marty Mickelson Mar 30 '16 at 23:48
  • Manually deleting storage/framework/delete got it out of maintenance mode. I noticed that using `php artisan down` doesn't create the file so I'm not sure what's going on there. This is starting to feel like I have a bum version of laravel. :(delete is a file for anyone who wants to know) – Marty Mickelson Mar 31 '16 at 00:01
  • are you able to solve your issue ? – Qazi Mar 31 '16 at 04:36
  • Can you check your database.php config? Also check that you're working with the correct project files. – Lance Pioch Mar 31 '16 at 06:18
  • No files show changed in Git unless I change something myself so I know it's the right folder... After restarting and removing the down file, I was able to get back to the login screen and trying to login didn't show that Access denied for homestead error, but instead seems to redirect me to same login screen so I end up at the login with blank fields again. Same thing with the registration screen. No users are added to the database when I check it's table contents. Now it seems that the database might not even be called. I'm dumbfounded... – Marty Mickelson Mar 31 '16 at 16:58

2 Answers2

0

I ran a virus scan on my Mac and lo and behold, it found some infections. After removing them, I tried the site again and it worked normally. An infection is what I assume caused the issues I had.

  • It has nothing to do with virus. haha The reason it worked for you is because you stopped the server and restarted it without even knowing it. You also don't need an antivirus on a mac too, I think you are being screwed somewhere bro. lol – eyoeldefare Jan 04 '18 at 20:28
0

You are hosting it on a its own dedicated server than an apache server. So you need to refresh your server when you update the .env file. Just stop the server and restart is again by using php artisan serve.

eyoeldefare
  • 2,136
  • 1
  • 15
  • 25