Skip to content

Missing mysqldump and mysql binaries in image #27

@thedustin

Description

@thedustin

Description

Hey, I recently set up a new CraftCMS project using this image. While creating a MySQL initialization script, I noticed that the craft db/backup command does not work because the mysqldump binary is missing. Similarly, the craft db/restore command fails due to the absence of the mysql binary.

Do you think the binaries should be included in the image? If not, could you recommend alternative (automatic) methods for backing up and restoring databases during development? This is will become useful in the future when I want to use a production backup in the development environment.

Steps to reproduce

  1. Setup a craft project with docker compose
  2. docker compose exec -it php-fpm ./craft db/backup or docker compose exec -it php-fpm ./craft db/restore $BACKUP_FILE_PATH
Backing up the database ... error: The shell command "mysqldump '--defaults-file'='/tmp/zsppvmhuwsqs.cnf' '--add-drop-table' '--comments' '--create-options' '--dump-date' '--no-autocommit' '--routines' '--default-character-set'='utf8mb4' '--set-charset' '--triggers' '--no-tablespaces' '--no-data' '--skip-triggers' '--result-file'='/app/storage/backups/x--2025-08-16-125926--v5.8.15.sql' 'craftcms' && mysqldump '--defaults-file'='/tmp/zsppvmhuwsqs.cnf' '--add-drop-table' '--comments' '--create-options' '--dump-date' '--no-autocommit' '--routines' '--default-character-set'='utf8mb4' '--set-charset' '--triggers' '--no-tablespaces' '--no-create-info' '--ignore-table'='craftcms.x_assetindexdata' '--ignore-table'='craftcms.x_cache' '--ignore-table'='craftcms.x_imagetransformindex' '--ignore-table'='craftcms.x_resourcepaths' '--ignore-table'='craftcms.x_phpsessions' '--ignore-table'='craftcms.x_sessions' 'craftcms' >> "/app/storage/backups/x--2025-08-16-125926--v5.8.15.sql"" failed with exit code 127: sh: 1: mysqldump: not found
Restoring database backup ... error: The shell command "mysql '--defaults-file'='/tmp/mubameyfwsau.cnf' 'craftcms' < "/app/storage/backups/x--2025-08-16-125926--v5.8.15.sql"" failed with exit code 127: sh: 1: mysql: not found

Additional info

  • Craft version: 5.8.15
  • PHP version: 8.3 (docker)
  • Database driver & version: mysql 8.0.42
  • Plugins & versions:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions