2

I am using docker-compose to build a web app with flask and mysql. I am using mysql:8.0 as base image for mysql, but I am facing issue with default-authentication-plugin. Here is my code...

version: "2"
services:
  app:
    build: ./app
    links:
      - db
    ports:
      - "5000:5000"

  db:
    image: mysql
    ports:
      - "3306:3306"
    environment:
      MYSQL_ROOT_PASSWORD: root
    command: --default-authentication-plugin=mysql_native_password
    restart: always

Following error message appears

Authentication plugin 'caching_sha2_password' is not supported
Vinod
  • 141
  • 2
  • 7
  • 1
    Hi take a look at this post this might help? [default authentication](https://stackoverflow.com/questions/50557234/authentication-plugin-caching-sha2-password-is-not-supported]) – Intellidroid Jun 25 '19 at 06:42
  • I am able to fix the problem in local and docker. I am facing issue in docker-compose. Is there any way to do this? – Vinod Jun 25 '19 at 11:51
  • What authentication is your app using to connect to the mysql? – Intellidroid Jun 26 '19 at 11:11
  • @Intellidroid mysql_native_password – Vinod Jun 26 '19 at 14:00
  • Can I just confirm....when you run both your app and mysql (not using docker-compose) i.e. two separate docker instances it works fine? `If there is no database initialized when the container starts, then a default database will be created. While this is the expected behavior, this means that it will not accept incoming connections until such initialization completes. This may cause issues when using automation tools, such as docker-compose, which start several containers simultaneously.` – Intellidroid Jun 26 '19 at 14:26
  • also have you tried building it using 5.6 and not 8? – Intellidroid Jun 26 '19 at 14:28
  • @Intellidroid running in separate works fine with giving ```--default-authentication-plugin=mysql_native_password``` – Vinod Jun 27 '19 at 09:39
  • @Intellidroid I am using mysql:8.0 – Vinod Jun 27 '19 at 09:40

0 Answers0