Symptoms
-
In Plesk, when trying to import a MariaDB dump from a different server, the following error appears:
Unable to Import the dump:
ERROR at line 1: Unknown command '/-'.
-
Migration of the subscription database fails with an 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:
/*!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:
Manually edit the dump.sql file and remove the line:
/*!999999- enable the sandbox mode */
- Login to server via SSH
- 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
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