Articles in this section

Import or migration of MySQL databases fails in Plesk ERROR at line 1: Unknown command '/-‘.

Applicable to:

  • Plesk Obsidian for Linux

Symptoms

  • In Plesk, when trying to import a MariaDB dump from a different server, the following error appears:

    PLESK_ERROR: Unable to Import the dump:
    ERROR at line 1: Unknown command '/-'.

  • Migration of the subscription database fails with an error:

    PLESK_ERROR: Failed to copy content of database 'wp_1420'
    Migration tools tried to perform operation in 3 attempts: Command execution failed on the local server with non-zero exit code.
    command: mysql --defaults-file=/usr/local/psa/var/modules/panel-migrator/sessions/20240608085832/target-server/my_localhost_wp_1420.cnf -h localhost -P 3306 -uadmin wp_1420 < /usr/local/psa/var/modules/panel-migrator/sessions/20240608085832/target-server/db-dumps/wp_1420.sql
    exit code: 1
    stdout:
    stderr: ERROR at line 1: Unknown command '\-'.

Cause

The SQL dumps generated by MariaDB on source server contains following on Line 1:

CONFIG_TEXT: /*!999999- enable the sandbox mode */

This returns a syntax error when importing to older versions of MariaDB or MySQL on destination servers and therefore it breaks transfers between servers where the version is not identical. This is a MariaDB bug which will not be fixed since it was added because of CVE-2024-21096

Resolution

There is no direct way to disable the line for dumps made with Plesk.

The options are:

 

         Solution 1: Manually edit the dump.sql file and remove the line 1 from the MySQL dumps

 

Manually edit the dump.sql file and remove the line:

CONFIG_TEXT: /*!999999- enable the sandbox mode */

    1. Login to server via SSH
    2. Manually remove the line 1 from the db-dumps that are placed in the directory using the following commands:

For example:

# sed --in-place  "1d" /usr/local/psa/var/modules/panel-migrator/sessions/SESSION_NAME/target-server/db-dumps/wp_1420.sql

Note: Replace the path in the above command with the actual path from the error in Plesk panel

      3. Restore that using the command from the migratory extension error:

For example:

# mysql --defaults-file=/usr/local/psa/var/modules/panel-migrator/sessions/20240608085832/target-server/my_localhost_wp_1420.cnf -h localhost -P 3306 -uadmin wp_1420 < /usr/local/psa/var/modules/panel-migrator/sessions/20240608085832/target-server/db-dumps/wp_1420.sql

Note: Replace the path in the above command with the actual path from the error in Plesk panel

 

Solution 2: Update MariaDB version on destination server to same as source server

 

Update destination server to have the same version as source, for example if source server has MariaDB 10.6.18 then upgrade the destination server MariaDB version to same.  How to upgrade MySQL 5.5 to 5.6/5.7 or MariaDB 5.5 to 10.x on Linux

 

Solution 3: Use another version of  mysqldump. If an update of mariadb is not possible “mysqldump“ on the source server can be replaced with “mysqldump” from the destination server.(Moving internal as the solution is not verified as per ticket research)

 

 

Was this article helpful?

Comments

2 comments
Date Votes
  • This error is also generated by the Plesk migrator, can you apply the workaround/fix directly in the Plesk Migrator code?

    0
  • Take a look over other options at https://mariadb.org/mariadb-dump-file-compatibility-change/

    Solution:

        Recommended: Import the dump using the secure client from a version of MariaDB Server that has the change.
        Use an older (insecure) version of mariadb-dump to take the backup.
        Remove the line at backup time with something like mariadb-dump|tail +2.
        Remove the line at import time with something like tail +2|mariadb.

    0

Please sign in to leave a comment.