[Solved] Mysql 8.0 without "Mysql2::Error: Authentication plugin 'caching_sha2_password' cannot be loaded"

Hi everyone,

I’ve just wanted to share the solution for the problem I’ve just fixed in one of my apps.

When I was using the latest version of Mysql:

# fragment of .circleci/config.yml
docker:
  - image: circleci/ruby:2.5.1-node-browsers
    environment:
      BUNDLE_JOBS: 3
      BUNDLE_RETRY: 3
      BUNDLE_PATH: vendor/bundle
      RAILS_ENV: test
      DATABASE_URL: mysql2://root:@127.0.0.1:3306/myapp_test?encoding=utf8
  - image: circleci/mysql:latest
    environment:
      MYSQL_DATABASE: myapp_test

I had the following problem:

Mysql2::Error: Authentication plugin ‘caching_sha2_password’ cannot be loaded: /usr/lib/x86_64-linux-gnu/mariadb18/plugin/caching_sha2_password.so: cannot open shared object file: No such file or directory

And here is the solution:

- image: circleci/mysql:latest
  # just add this:
  command: [--default-authentication-plugin=mysql_native_password]
  environment:
    MYSQL_DATABASE: myapp_test

I hope that it will help someone.

Best,
Marek

6 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.