Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,298,677
Community Members
 
Community Events
165
Community Groups

Unable to connect to mysql8 service container

Edited

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 Sep 02, 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

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,232 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you