mysqldockerdocker-composemysql-8.0

docker-compose : The server requested authentication method unknown to the client


I have this yml file for configuration of MySQL in docker:

# Use root/example as user/password credentials
version: '3.1'

services:

  db:
    image: mysql
    restart: always
    environment:
       MYSQL_ROOT_PASSWORD: 'pass'
       MYSQL_DATABASE: 'db'
       MYSQL_USER: 'user'
       MYSQL_PASSWORD: 'pass'

  adminer:
    image: adminer
    restart: always
    ports:
      - 8888:8080

And I start the container using following command from the same directory where yml is located:

docker-compose -f stack.yml up

Then I got this error:

then i get following error while logging in


Solution

  • This worked for me:

    image: mysql:5.7