Unable to connect to mysql8 service container

Balakrishnan S August 29, 2021

I am unable to connect to mysql running in service container, it's throwing the folllowing error

+ mysql -uroot -ptest_user_password -h127.0.0.1 -e 'SHOW DATABASES;'
ERROR 2059 (HY000): 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

I even set the MYSQL_DEFAULT_AUTH to mysql_native_password 

 

Edit: I wanted to use mysql 8 and not 5.7 or earlier version

below is by pipeline config

# Template NodeJS build

# This template allows you to validate your NodeJS code.

# The workflow allows running tests and code linting on the default branch.

image: node:14

pipelines:

default:

- step:

name: Build and Test

caches:

- node

services:

- mysql

script:

- apt-get update -y

- apt-get install -y mysql-client

- mysql -uroot -ptest_user_password -h127.0.0.1 -e 'SHOW DATABASES;'

definitions:

services:

mysql:

image: mysql:8.0.22

variables:

MYSQL_DATABASE: test_db_1

MYSQL_ROOT_PASSWORD: 'test_user_password'

1 answer

1 accepted

0 votes
Answer accepted
Mark C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 2, 2021

Hi @Balakrishnan S

Thank you for reaching out to the community.

I've tested the Docker image mysql:8.0.22 as a service on my Pipelines build as well.
However, I'm getting the same error.

I went ahead and searched the error message online.
It appears that Mysql 8 version is now using caching_sha2_password as the default authentication plugin instead of the native one which is mysql_native_password. More info here

For this, to enforce the native authentication for Mysql 8 version, the best I can suggest is for you to create your own Docker image with the Mysql version 8 and by enforcing the authentication plugin mysql_native_password.
You can upload that in Docker Hub as well and use it as a Docker service for your Pipelines build.

You can also use this sample Dockerfile to build your own Docker image.

Hope it helps and let me if you have further questions that I can help with.

Regards,
Mark C

Balakrishnan S September 2, 2021

Thanks Mark.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events