fradelg / docker-mysql-cron-backup

Docker image to backup all your databases periodically
Apache License 2.0
295 stars 111 forks source link

V1.13.1 not working with mariadb:10.1 #126

Open gioscarda opened 2 days ago

gioscarda commented 2 days ago

With this example docker compose config:

db:
    restart: unless-stopped
    environment:
      ...
    build:
      dockerfile_inline: |
        FROM mariadb:10.1

mysql-cron-backup-hourly:
    image: fradelg/mysql-cron-backup
    depends_on:
      - db
    volumes:
      - ./backup/hourly:/backup:Z
    environment:
      MYSQLDUMP_OPTS: --no-tablespaces
      MYSQL_HOST: db
      MYSQL_USER: {MYSQL_USER}
      MYSQL_PASS: {MYSQL_PASS}
      GZIP_LEVEL: 9
      CRON_TIME: "@hourly"
      MAX_BACKUPS: 24
      INIT_BACKUP: 1
    restart: unless-stopped

We retrieve the following error message in docker logs:

_mysqldump: Couldn't execute 'select column_name, extra, generation_expression, data_type from information_schema.columns where table_schema=database() and table_name=''': Unknown column 'generationexpression' in 'field list' (1054)

Downgrading to fradelg/mysql-cron-backup:1.13.0 it works fine.

Further info at https://stackoverflow.com/questions/75662086/suddenly-cannot-dump-remote-database-unknown-column-generation-expression-in (see comment by 0xC0DEGURU).

fradelg commented 1 day ago

Yes, the latest image use always the latest version of the client available in alpine repositories so it is not compatible with older versions of MySQL/MariaDB.

When the base alpine distribution was updated from 3.17 to 3.18, the mysql-client jumped from version 10.6.16-r0 to 10.11.8-r0:

https://pkgs.alpinelinux.org/packages?name=mysql-client&branch=v3.18&repo=&arch=x86_64&origin=&flagged=&maintainer=

which is throwing the error you get as it is described in the stackoverflow post.

So you can bump your version of mariadb docker base image or stick to the 1.13.0 version of the image of this repo.