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

前端 未结 3 1446
春和景丽
春和景丽 2020-12-30 06:21

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

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

services:

  db:
    image: mysq         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-30 06:47

    If you encounter this error but still wish to use MySQL v.8. You can do this by telling MySQL Server to use the legacy authentication plugin.

    So, your compose file will look like this:

    # Use root/example as user/password credentials
    
    version: '3.1'
    
    services:
    
      db:
        image: mysql
        command: --default-authentication-plugin=mysql_native_password
        restart: always
        environment:
           MYSQL_ROOT_PASSWORD: 'pass'
           MYSQL_DATABASE: 'db'
           MYSQL_USER: 'user'
           MYSQL_PASSWORD: 'pass'
    
      adminer:
        image: adminer
        restart: always
        ports:
          - 8888:8080
    

提交回复
热议问题