You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add support for different MariaDB dump versions #258
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 '\-'.).
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.
I'd like to take over this issue. I noticed the previous attempt in PR #294 has stalled.
My proposed approach is to handle the file via stdin while explicitly skipping the first line to ensure the header is ignored during the import. I will submit a new PR shortly.
Rather than unconditionally disabling the security fix, would it be possible for wp-cli to detect the MariaDB version in use (the target of the import) and only disable the fix on older versions that don't support sandbox mode?
Then users of up-to-date MariaDB versions would benefit from improved security while users of end-of-life versions would still be able to import the dump files.
I believe adding version detection is counterproductive. WP-CLI must remain reliable across diverse environments, and managing a version-detection matrix adds unnecessary complexity and points of failure.
Since wp db import is an intentional action performed by a user with their own trusted data, the risk of a malicious dump is negligible compared to the daily friction of failed imports. Using the official MariaDB workaround - stripping the sandbox line - is the most robust, database-agnostic way to ensure compatibility for all users
Activity
strarsis commentedon Jul 19, 2024
Related issue: #254
chrilleferna commentedon Jul 22, 2024
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
Evgenii-Zinner commentedon Jan 6, 2026
I'd like to take over this issue. I noticed the previous attempt in PR #294 has stalled.
My proposed approach is to handle the file via stdin while explicitly skipping the first line to ensure the header is ignored during the import. I will submit a new PR shortly.
lir-ht commentedon Jan 27, 2026
Rather than unconditionally disabling the security fix, would it be possible for wp-cli to detect the MariaDB version in use (the target of the import) and only disable the fix on older versions that don't support sandbox mode?
Then users of up-to-date MariaDB versions would benefit from improved security while users of end-of-life versions would still be able to import the dump files.
Evgenii-Zinner commentedon Jan 28, 2026
I believe adding version detection is counterproductive. WP-CLI must remain reliable across diverse environments, and managing a version-detection matrix adds unnecessary complexity and points of failure.
Since wp db import is an intentional action performed by a user with their own trusted data, the risk of a malicious dump is negligible compared to the daily friction of failed imports. Using the official MariaDB workaround - stripping the sandbox line - is the most robust, database-agnostic way to ensure compatibility for all users
swissspidy commentedon Mar 13, 2026
I don't think it should be WP-CLI's responsibility to strip the sandbox line, either via streaming or otherwise modifying the file.
Users can easily do that before using WP-CLI. Then it becomes a conscious decision, not something magical.