Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

439
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!