db-command
db-command copied to clipboard
Add support for different MariaDB dump versions
Feature Request
- [x] Yes, I reviewed the contribution guidelines.
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.
Related issue: https://github.com/wp-cli/db-command/issues/254
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