Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

436
Visualizações
How to fix 'The server requested authentication method unknown to the client [caching_sha2_password]' on docker compose?

I'm setting up a wamp. The docker-compose was working very well until I experience some problems with the phpmyadmin and mysql container. I couldn't connect nor from php or phpmyadmin and usually had this error message : mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]

I was able to solve the problem by just connecting entering the shell of the db container docker exec -it db mysql -uroot -p and running this command : ALTER USER 'root' IDENTIFIED WITH mysql_native_password by '123456'; But this kind of boring because I have a partner working on the same project and we have to change working posts a lot so it means rerun docker each time in the development phase so I was wondering what's wrong on my docker-compose...

Here it is :

version: "3.1"
services:
    www:
        build: .
        container_name: app
        ports: 
            - "8001:80"
        volumes:
            - ~/Desktop/WORK_in_progress/camagru/www/:/var/www/html/
        links:
            - db
        networks:
            - default
    db:
        image: mysql:8.0
        container_name: db
        restart: always
        tty: true
        ports: 
            - "3306:3306"
        command: --default-authentication-plugin=mysql_native_password
        command: --innodb-use-native-aio=0
        environment:
            MYSQL_DATABASE: CAMAGRU
            MYSQL_USER: user
            MYSQL_PASSWORD: 123456
            MYSQL_ROOT_PASSWORD: 123456 
        volumes:
            - ~/Desktop/WORK_in_progress/camagru/dump:/docker-entrypoint-initdb.d
            - ~/Desktop/WORK_in_progress/camagru/conf:/etc/mysql/conf.d
            - persistent:/var/lib/mysql
        networks:
            - default
    phpmyadmin:
        container_name: phpmyadmin
        restart: always
        tty: true
        image: phpmyadmin/phpmyadmin
        links: 
            - db:db
        ports:
            - 8000:80
        environment:
            MYSQL_USER: user
            MYSQL_PASSWORD: 123456
            MYSQL_ROOT_PASSWORD: 123456
volumes:
    persistent:

note : I don't use any configurations file, I modified a bit a compose that I found online.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Your command is right, the issue appears because you have defined the command key two times, and the second one is overriding the first one. Instead you should define it only once and like this:
command: --default-authentication-plugin=mysql_native_password --innodb-use-native-aio=0

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda