Valet and Laravel 5.5 Access denied for user 'root'@'localhost'

Posted 1 year ago by eddieace

Hello. 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` = [email protected] 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?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.