Sync Script: Fix for "ERROR at line 1: Unknown command '\-'."

When running the sync script from a source DB with an updated version of MariaDB to an outdated version, you’ll receive the following error:

ERROR at line 1: Unknown command '\-'.

This is due to a MariaDB dump file compatibility change. Essentially, if you’re syncing from a MariaDB version newer than 10.5.25, 10.6.18, 10.11.8, 11.0.6, 11.1.5, 11.2.4 and 11.4.2 to an older version, you’ll receive this error.

There are two options here:

  1. Update the destination MariaDB version.
  2. Add | tail +2 before each wp import command in the “Syncing database…” section of the script.

For example:

wp "@$FROM" db export --default-character-set=utf8mb4 - | tail +2 | wp db import - &&

This removes the new sandbox mode trigger (/*!999999\- enable the sandbox mode */) from the top of the dump at the time of import.


I encountered the same issue yesterday, but had not looked further into it.

1 Like