db-command icon indicating copy to clipboard operation
db-command copied to clipboard

Add support for different MariaDB dump versions

Open strarsis opened this issue 1 year ago • 2 comments

Feature Request

Describe your use case and the problem you are facing MariaDB introduced broke with backward dump file compatibility, trying to import such a dump in older target versions of MariaDB would therefore result in an error (ERROR at line 1: Unknown command '\-'.).

  • https://mariadb.org/mariadb-dump-file-compatibility-change/
  • https://discourse.roots.io/t/sync-script-fix-for-error-at-line-1-unknown-command/27734

Describe the solution you'd like According to the official blog post/announcement there are workarounds that should make the dump again compatible with older versions of MariaDB.

strarsis avatar Jul 17 '24 20:07 strarsis

Related issue: https://github.com/wp-cli/db-command/issues/254

strarsis avatar Jul 19 '24 23:07 strarsis

The change introduced by mariadb mid-May was to add the following line at the top of the sql dump file:

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

When trying to import such a file this results in the described fatal error.

The simplest(?) and most robust(?) workaround would be to test if the dumpfile contains this line and if so remove it before the import (tail +2).

Would be VERY nice if you could fix this

chrilleferna avatar Jul 22 '24 12:07 chrilleferna