7

I get the error whenever I try to access the route created with valet home.test. I have tried all the solutions listed in similar issues like this solution but nothing seems to work

The error is:

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from `user_meta` where `user_id` is null limit 1) 
MySQL version - 8.0.19 PHP version - 7.4.7 

My migrations work fine as I can see the tables created.

Any help would be appreciated.

Update.env config

DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=home DB_USERNAME=root DB_PASSWORD=abcd TENANCY_HOST=localhost TENANCY_PORT=3306 TENANCY_DATABASE=home TENANCY_USERNAME=root TENANCY_PASSWORD=abcd 
3
  • Post your Database configurations from env Commented Jul 13, 2020 at 10:15
  • This may help you Link 1 Commented Jul 13, 2020 at 12:28
  • 1
    This was happening to me when using laravel but running commands such as migrate from the wrong shell. See my answer here: stackoverflow.com/a/66910286/241138 Commented Apr 1, 2021 at 19:29

3 Answers 3

5

I guess this query solved your problem.

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root'; 
Sign up to request clarification or add additional context in comments.

Comments

5

You have to change MySQL settings. Edit /etc/mysql/mysql.conf.d/mysqld.cnf file and put this setting in mysqld section:

[mysqld] default_authentication_plugin= mysql_native_password 

Then run following command:

FLUSH PRIVILEGES; 

Then you may need to restart the mysql services for the changes to take effect:

sudo service mysql restart 

1 Comment

I tried every solution possible, but this was the only one that worked.
2

The main reason is that here is a new MySQL version, but an old PHP version. Since MySQL 8.0.34 (i think your version is not 8.0.19 and it's higher) using a new authentication method and old auth method mysql_native_password is deprecated. I faced with this issue in a Moodle.

đź’ˇ Solution for error authentication method unknown to the client is to update PHP version to 8+ or downgrade MySQL version to 5.7.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.