Coder Social home page Coder Social logo

mysqldump: 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 about docker HOT 11 CLOSED

craftcms avatar craftcms commented on May 25, 2024
mysqldump: 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

from docker.

Comments (11)

jamesmacwhite avatar jamesmacwhite commented on May 25, 2024 1

@jasonmccallister Found the dependency it's mariadb-connector-c, this package adds the plugin that's missing. I can add this to my own Dockerfile, or if you are willing to include in the dev Craft Docker images potentially? This seems like a potentially broken mysqldump situation with MySQL 8 environments out of the box.

The whole caching_sha2_password situation has been a right mess. MariaDB themselves even noped out on it: https://mariadb.com/kb/en/authentication-plugin-sha-256/

However, the fix is having mariadb-connector-c package from Alpine installed.

from docker.

jamesmacwhite avatar jamesmacwhite commented on May 25, 2024 1

@khalwat Thanks! I have submitted a PR with the package added to the PHP 7.4 and 8.0 dev images. Despite the PHP docs, it seems 7.4 is the first PHP version to have full support.

from docker.

jasonmccallister avatar jasonmccallister commented on May 25, 2024 1

Changes by @jamesmacwhite (thank you!) have been merged, I will tag a release in the next couple of days to trigger a new build.

from docker.

jamesmacwhite avatar jamesmacwhite commented on May 25, 2024

I'm aware that you can switch to native password, but this wouldn't seem to be the right thing given a library is missing entirely and Craft 3 should of course be able to support the caching_sha2_password mechanism with the PHP 7.4 dev image.

Is there perhaps a missing package that contains the libraries in addition to mysql-client?

from docker.

jasonmccallister avatar jasonmccallister commented on May 25, 2024

Hi @jamesmacwhite, are you using the -dev images or the non-dev? The -dev images install mysql-client tools because they are using for the Nitro sites containers... The non-dev images do not install composer, git, or the database tools.

In the usage section we document how to add your own extensions and backup tools. These are from the Alpine Linux repository which appear to be mariadb.

from docker.

jamesmacwhite avatar jamesmacwhite commented on May 25, 2024

Hi @jasonmccallister. Yep using the dev images PHP 7.4 dev to be exact. I noticed these were added to the images more recently, which is nice I had modified our Dockerfile to add git, and mysql-client manually but since pulled the latest PHP FPM image to negate doing that now.

It does indeed appear to be that the Alpine packages are built against mariadb. I'm trying to get some further understanding on why the library file is missing entirely. I was wondering if there's a further dependency package needed or something, although even in Docker related searches I'm not getting a clear picture why the lib file isn't present. A lot of the guidance is switch to native password, but that's not the fix, because caching_sha2_password should be handled fine with MySQL 8 and Craft 3, it appears it's just the library itself is just not there. Perhaps not a bug in these Docker images specifically but something with Alpine?

The whole folder plugin folder being empty is a bit strange.

from docker.

jamesmacwhite avatar jamesmacwhite commented on May 25, 2024

By default the mysql-client package does not have support for caching_sha2_password because it is built against mariadb, so the addition of this package is needed for supporting modern connections to MySQL 8, where native password is not used or has been enabled (Any newly provisioned MySQL 8 DB is unlikely to have it enabled). The MySQL 8 container itself of course supports this without any problems, but mysqldump will be running from the PHP-FPM container which is where this problem is coming from.

Certainly on the dev images it would be nice to have the mariadb-connector-c package installed. Anyone who's using these docker images with MySQL 8, who hasn't allowed their database to use the legacy native password method is going to hit this, possibly in Nitro as well?

from docker.

kylecotter avatar kylecotter commented on May 25, 2024

@jamesmacwhite I've experienced this for a while (not specific to the Craft Docker image) and couldn't for the life of me figure out which extra dependency I needed to add. Thanks for figuring it out! 🎉

Can confirm adding that to our Dockerfile allows Craft's backup commands to work OOTB with MySQL8.

from docker.

jamesmacwhite avatar jamesmacwhite commented on May 25, 2024

@kylecotter Glad it helped! Hoping @jasonmccallister will implement this dependency directly in the dev images. After discovering the MySQL client tools package is built against MariaDB, it doesn't have support for caching_sha2_paasword by default and likely never will given MariaDB doesn't support it out of the box either.

I guess only MySQL 8 specifically is hit when the default password mechanism changed. 5.7 and lower will not encounter it, MariaDB won't either as it doesn't use it.

from docker.

khalwat avatar khalwat commented on May 25, 2024

Thx @jamesmacwhite -- this fixed it for me as well.

@jasonmccallister you'll likely want to add mariadb-connector-c to the base images; a bet a fair number of people will be picking mysql:8.0 as their db of choice, since that's the example in the docs.

from docker.

kylecotter avatar kylecotter commented on May 25, 2024

@jamesmacwhite @khalwat either of you ever have the issue with the dump from this setup not actually be importable elsewhere?

from docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.