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: https://github.com/arey/mysql-client/issues/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'm using a docker-compose setup consisting of a
mysql:8.0
, awordpress:6
and awordpress: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 themariadb-connector-c
package (see: https://github.com/arey/mysql-client/issues/5)I can confirm; it now works, using the following hacky Dockerfile for the cli:
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…