Authentication plugin 'caching_sha2_password&#

2019-04-10 09:20发布

I've recently encountered problems when testing code in CircleCi 2. Parts of our config.yml:

jobs:
  build:
    environment:
    docker:
      ...
      - image: circleci/mysql
      - image: rabbitmq:3-alpine
    working_directory: ~/webapp

    steps:
      ...
      - run:
          name: Prepare DB
          command: echo "create database" | mysql --host 127.0.0.1

The build fails at Prepare DB with

ERROR 2059 (HY000): Authentication plugin 'caching_sha2_password' cannot be loaded: Error loading shared library /usr/lib/mysql/plugin/caching_sha2_password.so: No such file or directory Exited with code 1

This error only occurred now, and no changes has been made to the circle / mysql setup.

From e.g. https://stackoverflow.com/a/49944625/2713641 it is specified that one can set a --default-authentication-plugin=mysql_native_password flag but not sure if that applies here, or how to apply it in a circle ci setup.

1条回答
何必那么认真
2楼-- · 2019-04-10 09:37

This problem is mysql 8 specific (as pointed out by Raymond), and the error occured due to CircleCi upgrading their latest docker image to mysql 8. Therefore, the solution to our specific case (we are using mysql 5.7) was simply to specify the appropriate tag for the mysql docker image:

jobs:
  build:
    environment:
    docker:
      ...
      - image: circleci/mysql:5.7
查看更多
登录 后发表回答