Skip to content

Add support for different MariaDB dump versions #258

Closed as not planned
Closed as not planned

Description

@strarsis

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 '\-'.).

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.

Activity

  1. strarsis commented on Jul 19, 2024

    @strarsis
    Author

    Related issue: #254

  2. chrilleferna commented on Jul 22, 2024

    @chrilleferna

    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

  3. Evgenii-Zinner commented on Jan 6, 2026

    @Evgenii-Zinner

    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.

  4. lir-ht commented on Jan 27, 2026

    @lir-ht

    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.

  5. Evgenii-Zinner commented on Jan 28, 2026

    @Evgenii-Zinner

    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

  6. swissspidy commented on Mar 13, 2026

    @swissspidy
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions