Skip to content

Mariadb compatibility issues #98

@silverstripesk

Description

@silverstripesk

Module version(s) affected

any

Description

Dumping DB with latest MariaDB versions generates /*!999999- enable the sandbox mode */ on top of sql file. Importing such file in older versions is not successful.

More info: [https://mariadb.org/mariadb-dump-file-compatibility-change/]

How to reproduce

Just dump on latest MariaDB version and try to import to older one.

Possible Solution

Changing Webroot.php

from

$stream = $sspak->readStreamForFile('database.sql.gz');
		$this->exec("gunzip -c | sed '/^CREATE DATABASE/d;/^USE/d' | mysql --default-character-set=utf8 $usernameArg $passwordArg $hostArg $portArg $databaseArg", array('inputStream' => $stream));
		fclose($stream);
		return true;

to

$stream = $sspak->readStreamForFile('database.sql.gz');
		$this->exec("gunzip -c | sed '1{/999999.*sandbox/d}' | sed '/^CREATE DATABASE/d;/^USE/d' | mysql --default-character-set=utf8 $usernameArg $passwordArg $hostArg $portArg $databaseArg", array('inputStream' => $stream));
		fclose($stream);
		return true;

should make it working again.

Additional Context

No response

Validations

  • Check that there isn't already an issue that reports the same bug
  • Double check that your reproduction steps work in a fresh installation of silverstripe/installer (with any code examples you've provided)

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions