Skip to content

Fix compatibility with MariaDB 12 (and future versions)#939

Open
mattijv wants to merge 2 commits into
wardenenv:mainfrom
mattijv:fix-db-service-command
Open

Fix compatibility with MariaDB 12 (and future versions)#939
mattijv wants to merge 2 commits into
wardenenv:mainfrom
mattijv:fix-db-service-command

Conversation

@mattijv

@mattijv mattijv commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Issue

Trying to use MariaDB 12 in a Magento project caused the db (and tmp-mysql) service to fail with the following error:

2026-06-16 06:59:44+00:00 [Note] [Entrypoint]: Entrypoint script for MariaDB Server 1:12.2.2+maria~ubu2404 started.
2026-06-16 06:59:44+00:00 [ERROR] [Entrypoint]: mariadbd failed while attempting to check config
        command was: mysqld --max_allowed_packet=1024M --explicit_defaults_for_timestamp=on --verbose --help
        /usr/local/bin/docker-entrypoint.sh: line 105: mysqld: command not found

This is due to MariaDB removing the mysql compatibility symlinks from their Docker images by default.

In addition the warden db commands do not work, for the same reason.

This was previously fixed in wardenenv/images#50 by explicitly installing the MySQL compatibility packages if the MariaDB version was 11. However, that fix does not work when using 12 (12.3 is the suggested version for newer Magento releases).

We could fix the issue by always installing the compatibility packages (instead of just for MariaDB 11). This PR offers a different approach.

Steps to reproduce

A Magento 2 environment with this configuration for the DB.

MYSQL_DISTRIBUTION=mariadb
MYSQL_DISTRIBUTION_VERSION=12.2

Proposed Fix

Services

For the DB services we can let the container entrypoint script to determine the correct command, instead of providing an explicit one.

Inspecting even older MySQL/MariaDB image entrypoint scripts

docker run --rm --entrypoint cat mysql:5.6 /usr/local/bin/docker-entrypoint.sh

show that they all (that I spot checked, at least) have this kind of snippet in the beginning of the main part of the script

_main() {
	# if command starts with an option, prepend mysqld
	if [ "${1:0:1}" = '-' ]; then
		set -- mysqld "$@"
	fi

So we do not actually need to provide the explicit command at all, but the container can decide what command to use.

Commands

The db command has previously used the MYSQL_DISTRIBUTION environment variable for deciding which DB upgrade command to use.

This PR changes the command to do the same also for the client and dump commands.

Using MYSQL_DISTRIBUTION

I don't know if the warden db upgrade command has ever worked, as the MYSQL_ variables are read from the container's environment variables, and the MYSQL_DISTRIBUTION was never added there. In testing the command just failed for me.

This PR fixes that issue by including the MYSQL_DISTRIBUTION in the DB container environment, though that feels a tad hacky to be honest.

Copilot AI review requested due to automatic review settings June 26, 2026 08:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Warden environment DB service definitions to improve compatibility with newer MariaDB images (e.g., MariaDB 12) by no longer hardcoding the server binary (mysqld) in compose command: arrays, relying instead on the image entrypoint behavior when the first argument is an option.

Changes:

  • Removed explicit mysqld from several environment DB service command: lists so the container entrypoint can select the correct server binary.
  • Updated Magento split DB and test DB service definitions to follow the same pattern.
  • Added an UNRELEASED changelog entry referencing the fix for #864.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
environments/magento2/magento2.tests.base.yml Removes explicit mysqld from tmp DB command so entrypoint can choose the correct binary.
environments/magento2/magento2.splitdb.sales.base.yml Removes explicit mysqld from sales split DB service command.
environments/magento2/db.base.yml Removes explicit mysqld from main Magento 2 DB service command.
environments/magento1/db.base.yml Removes explicit mysqld from Magento 1 DB service command.
environments/drupal/db.base.yml Removes explicit mysqld from Drupal DB service command.
environments/cakephp/db.base.yml Removes explicit mysqld from CakePHP DB service command.
CHANGELOG.md Notes the fix in the UNRELEASED “Bug Fixes” section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread environments/magento2/db.base.yml
Comment thread CHANGELOG.md
@mattijv mattijv force-pushed the fix-db-service-command branch 2 times, most recently from 5bb450e to 23a39d4 Compare June 26, 2026 08:32
@mattijv mattijv requested a review from Copilot June 26, 2026 08:33
@mattijv

mattijv commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Noticed the the db command also uses mysql for the commands, which won't work with newer MariaDB images. I'll change that as well.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread environments/shopware/db.base.yml
@mattijv mattijv force-pushed the fix-db-service-command branch 2 times, most recently from 0e1ea88 to a03dbfe Compare June 26, 2026 10:26
@mattijv mattijv requested a review from Copilot June 26, 2026 10:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 4 comments.

Comment thread commands/db.cmd
Comment thread commands/db.cmd
Comment thread environments/shopware/db.base.yml Outdated
Comment thread commands/db.cmd Outdated
mattijv added 2 commits June 26, 2026 13:33
The entrypoint script in the MySQL/MariaDB images automatically prepend
the correct binary name to the command if the first argument starts
with the "-" character.

Since MariaDB removed the MySQL compatibility symlinks from their
Docker images, the previous "mysql" command started failing.

This commit removes the explicit command name from the DB service
definitions, since the entrypoints (in both MySQL and MariaDB images)
are smart enough to prepend the correct command if we just supply the
arguments.
MariaDB stopped including the `mysql` symlinks in the official Docker
images, so now the commands using `mysql` or `mysqldump` are failing
with newer MariaDB versions.

This commit adds logic to determine the appropriate commands to use
based on the MYSQL_DISTRIBUTION (as that was already used previously
for the `warden db upgrade` subcommand).

However, it seems like the upgrade subcommand has never worked! The
MYSQL_ variables are exctracted from the DB containter environment
variables, but the MYSQL_DISTRIBUTION was never added as an environment
variable in the DB containers. Running the upgrade command results in
the following:

ERROR: The upgrade command only supports MySQL and MariaDB
installations.

This commit changes the DB services to include the MYSQL_DISTRIBUTION
in the environment variables, so it can be used in the warden commands
as intended(?).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment thread commands/db.cmd
Comment on lines +31 to +40
case "${MYSQL_DISTRIBUTION}" in
mariadb)
clientCmd="mariadb"
dumpCmd="mariadb-dump"
;;
*)
clientCmd="mysql"
dumpCmd="mysqldump"
;;
esac

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is backwards compatible to how it worked previously. Not in the scope to change that, unless requested by the maintainers.

@mattijv mattijv changed the title Remove explicit mysql from DB service commands (fixes compatibility with MariaDB 12) Fix compatibility with MariaDB 12 (and future versions) Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants