问题
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:
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
回答2:
If you want to keep mysql 8, configure it this way
- image: circleci/mysql:latest
# just add this:
command: [--default-authentication-plugin=mysql_native_password]
environment:
MYSQL_DATABASE: myapp_test
Source : https://discuss.circleci.com/t/solved-mysql-8-0-without-mysql2-authentication-plugin-caching-sha2-password-cannot-be-loaded/25791
来源:https://stackoverflow.com/questions/49979089/authentication-plugin-caching-sha2-password-cannot-be-loaded-in-circleci-mysql