Skip to content

CLI variant fails connecting to MySql server via caching_sha2_password #862

Open
@febsn

Description

@febsn

I'm using a docker-compose setup consisting of a mysql:8.0, a wordpress:6 and a wordpress:cli container. Wordpress itself works fine, but the CLI failed to connect to the server saying:

Failed to get current SQL modes. Reason: 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

I dug deeper and found out that the underlying php:8.x-alpine image doesn't seem to include the necessary libraries per default, but they can be added by installing the mariadb-connector-c package (see: arey/mysql-client#5)

I can confirm; it now works, using the following hacky Dockerfile for the cli:

FROM wordpress:cli

USER root
RUN apk add --no-cache mariadb-connector-c

USER www-data

I'd suggest that the package be included in the wordpress:cli variant. Supposedly it could be added in https://github.com/docker-library/wordpress/blob/master/Dockerfile.template after line 17 – I don't feel competent enough for a PR…

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions