mysql-client icon indicating copy to clipboard operation
mysql-client copied to clipboard

MySQL 8.x - Plugin caching_sha2_password could not be loaded

Open ysiivan opened this issue 3 years ago • 15 comments

Getting

 / # mysql -h mysql-service 
ERROR 1045 (28000): Plugin caching_sha2_password could not be loaded: Error loading shared library /usr/lib/mariadb/plugin/caching_sha2_password.so: No such file or directory

ysiivan avatar Feb 10 '22 23:02 ysiivan

Do you solve your issue? Do you have it with the published Docker image or by building yourself the Dockerfile of this repository?

arey avatar Feb 16 '22 12:02 arey

I was using the published image. As far as I can tell the Alpine MySQL client package (assembled from MariaDB sources) is incomplete and is not compatible with a default MySQL 8.x install. I had to use a whole MySQL 8 image for just the client part. Much larger, but it works.

ysiivan avatar Feb 17 '22 07:02 ysiivan

We have exactly the same problem here, when trying to connect to OVH managed databases

toussa avatar Jun 10 '22 08:06 toussa

@toussa if you want, I could update the Dockefile to use the MySQL 8 image as suggests @ysiivan @ysiivan do you stiil have the Dockerfile you have used?

arey avatar Jun 18 '22 11:06 arey

@arey thanks for the proposition but there is no need of a Dockerfile for mysql:8 image, because it has everything inside (and actually too much if you just use the client).

For example, my docker compose looks like:

mysql-cli:
    image: mysql:8
    entrypoint: "mysql"

However, a useful Dockerfile might be to remove what is not needed for mysql client to work

toussa avatar Jun 21 '22 08:06 toussa

Thank tou @toussa for your feedback. Another solution could be to install the missing /usr/lib/mariadb/plugin/caching_sha2_password.so shared library to the image. If anyone is interested, you're welcome.

arey avatar Jul 14 '22 13:07 arey

A solution here which installs caching_sha2_password is to add the following package mariadb-connector-c-dev

olivernybroe avatar Nov 01 '22 07:11 olivernybroe

A solution here which installs caching_sha2_password is to add the following package mariadb-connector-c-dev

nice 😃

pandasir avatar May 31 '23 02:05 pandasir

Hi @olivernybroe and @pandasir Could you please submit a Pull Request with this change? Thus I could publish a fixed version. Thanks :-D

arey avatar May 31 '23 06:05 arey

Thanks to @olivernybroe the path has been pushed to Docker Hub. I let you try it.

arey avatar Jun 01 '23 06:06 arey

A solution here which installs caching_sha2_password is to add the following package mariadb-connector-c-dev

I found that mariadb-connector-c is sufficient.

ionling avatar Jul 04 '23 08:07 ionling

Thanks for the feedback @ionling If you want you could submit a Pull Request and change mariadb-connector-c-dev to mariadb-connector-c

arey avatar Jul 06 '23 06:07 arey

Same error using mysql:8 on docker compose -> Fix: in my dockerfile add this:

FROM alpine:3.14 ... RUN apk add --no-cache mariadb-connector-c

rodrigosampayo1 avatar Dec 27 '23 14:12 rodrigosampayo1

I @rodrigosampayo1 which image version are you using? I thought the problem had been solved with the latest image https://hub.docker.com/layers/arey/mysql-client/latest/images/sha256-54f844baa87f675879b0aa409344b5d51ad2d4fcf240580fc1dde7689cfbccf0?context=repo

arey avatar Dec 27 '23 15:12 arey

Unfortuntely, I had the same issue (and fortunately the same fix). I'm running a cron container, building from alpine, same as @rodrigosampayo1

FROM alpine:3
...
RUN apk add --no-cache mysql-client mariadb-connector-c
...

RickMeijer avatar Jan 15 '24 21:01 RickMeijer