Access denied for user 'root'@'localhost' Laravel / debian 18

33
January 12, 2019, at 02:40 AM

I have a problem with laravel and mysql. It is possible for me to php artisan migrate and seed my database. But on the other side accessing to a page using the database is impossible for me. I receive the following error:

SQLSTATE[HY000][1698] Access denied for user 'root' @'localhost' (SQL: select * from `users`)

My .env is correctly filled in (I can migrate without worries)

My application runs under a debian 18.

Does anyone have any idea where this might come from?

Answer 1

The root user in mysql 5.7 now requiers sudo. That means phpMyAdmin will be not able to use mysql -u root anymore and have to do sudo mysql -u root credentials.

What you have to do is create a new user with the same privileges as the root credentials and use that instead.

Here's how you can do it.

READ ALSO
Getting non duplicate results from bridging table

Getting non duplicate results from bridging table

I have three tables, contact, contact_category and contact_categories

31
PHP While Statement Delete only one row from table Mysql PDO

PHP While Statement Delete only one row from table Mysql PDO

I have a while statement and a PDO statement to delete one row if someone clicks the delete button

8
How do I convert a number enum column to tinyint?

How do I convert a number enum column to tinyint?

Developing in Laravel 57, using a MySQL database

35