I just started a new project and I use Valet for all my new projects. I also use a mysql DB that is installed on my local machine. It works on all my old projects using Laravel 5.4, 5.3 and 5.2. For some reason, I get this error.
SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from `users` where `email` = john.doe@example.com limit 1)
My .env file looks like this.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=new_project
DB_USERNAME=root
DB_PASSWORD=
And as I said before, this works on all my old projects.
If I run tinker and for example run a simple call to the database, the connection works. So this error is only in the browser.
$users = App\User::all();
=> Illuminate\Database\Eloquent\Collection {#752
all: [],
}
Any clues?