2

Why do I see this issue below during the installation of Magento 2.4?

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client

Magento 2.4 MySQL

1 Answer 1

4

This is happening because of MySQL 8, which by default uses the plugin auth_socket. Applications will most times expect to log in to your database using a password, to do it access the MySQL via root user and run this command:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';  

Then try to connect using it:

mysql -u root -proot

If you are using Docker you can specify it like this example below.

Make sure that you're not using MariaDB to connect into the DB, check it using mysql --version inside your PHP container.

version: '3.7'
services:
db:
    image: mysql:8.0.0
    command: ["--default-authentication-plugin=mysql_native_password"]
    ports:
        - "3306:3306"
    environment:
        MYSQL_ROOT_PASSWORD: root
        MYSQL_USER: magento
        MYSQL_PASSWORD: magento

I fixed it using mysql:5.7.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.