Recent MariaDB Dump File Compatibility Change breaks ```wp db import -```

I’m curently upgrading an old trellis project which uses trellis-database-uploads-migration to push / pull and backup databases.

It looks pretty old so I’ve no idea if anyone still uses it. However, a recent compatibility change in mariadb introduces a breaking change that may affect anyone using a similar approach to

wp db export --allow-root - | gzip > {{ dump_file }}

This change inserts a comment at the top of the file which causes wp db import - to fail on \-

/*!999999\- enable the sandbox mode */

piping the export into awk as before gzipping seems to work conditionally but isn’t fully tested as yet:

awk 'NR == 1 && /!999999\\- enable the sandbox mode / {next} {print}'


I did a quick search prior to posting but I was on a train at the time, and github treated said search as a regex.

That’s my excuse :slight_smile:

No worries at all, I just wanted to link the issue about this from the repo

What a weird, crazy bug :eyes:

1 Like