Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Authentication plugin 'caching_sha2_password' cannot be loaded in circleci/mysql

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.

like image 854
simen-andresen Avatar asked Dec 13 '22 17:12

simen-andresen


1 Answers

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
like image 80
simen-andresen Avatar answered Dec 18 '22 00:12

simen-andresen