
Error on MSQL import process
Intro
A common case involves trying to sync the MYSQL database from a remote development server to a local machine (or similar operations).
In this instance, the operation resulted in the following error:
Error:
ERROR at line 1: Unknown command '\-'.
As we can see a recent automated MariaDB patch added a security-related line to the database dump file, which is now causing the local database sync to fail. The sync process needs to be updated to handle this new file format.
Cause of the Failure
The failure is caused by a security-related change in the newer MariaDB version.
- Security Update: MariaDB 10.4.34 introduced a security feature to prevent shell commands from being executed within database dumps.
- The Impact: This feature adds an extra line (or a new comment) to the very beginning of the database dump file.
- The Problem: Your existing sync tool or script doesn't expect this new line at the start of the file, causing the import process to fail or break the sync command.
The line in backup.sql file that trigger the error on an import
/*!999999\- enable the sandbox mode */
This new line confuses older import tools or the default SQL client, which sees the comment as an unknown command.

"/*M!999999\- enable the sandbox mode */"
We used the head command to display the file's content.
Solution
These methods modify the import command or the file itself before the import begins. Making the import process possible
Using the --force
flag tells the mysql
or mariadb
client to continue the import process even if it encounters an error, effectively skipping the problematic first line.
#or
tail -n +2 backup.sql > fixed-backup.sql
#or
sed '1,2d' backup.sql > fixed-backup.sql
Using the sed command to remove the error-triggering line.
Using the tail command to remove the first line that causes the error on an import.
Using the sed command to remove the first 2 lines.
Update the destination MariaDB or MySQL client (and server, if applicable) to a version that natively understands the new security directive.
Version > MariaDB 10.5.25
Summary
In this guide, we diagnosed the "Error at line 1: Unknown command" import failure, discovering it's caused by a MariaDB security patch (v10.4.34+) that inserts an unexpected comment on the dump file's first line. We found that this error can be quickly resolved by using the --force flag during the SQL import or by applying shell commands (like tail or sed) to filter the first line. The best long-term solution is updating the local MariaDB client for full compatibility.