docker-library / docker-library/wordpress
CLI variant fails connecting to MySql server via caching_sha2_password
Nobody has claimed this yet.
- Dominant language
- Shell
- Stars
- 2k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
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'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…
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect Dockerfile.template around the suggested location and compare it with the reported Dockerfile workaround. Add the mariadb-connector-c package to the wordpress:cli image, then build the CLI variant and verify it connects to MySQL 8 using caching_sha2_password without the missing-plugin error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, docker-compose, mysql, php
- Domain
- databases, devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100