Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem exporting and importing Databases caused by MariaDB Dump File Compatibility Change #384

Closed
TheMetMan opened this issue Jun 1, 2024 · 5 comments · Fixed by #440 or #442
Closed

Comments

@TheMetMan
Copy link

This is for anyone else who might come across this problem.

I was trying to do an update to all my sites yesterday and came across this error when importing the Production Export to Local:

Importing the Database
ERROR at line 1: Unknown command '\\-'.
gzip: stdout: Broken pipe

Looking at line 1 in the database I had exported I see this:
/*!999999\- enable the sandbox mode */
However on older exports this line is not there.
So from the MariaDB site here you will see the reason for this which is dated 2024-05-17 so very recent.

The solution is to remove this line if it exists from the database dump before importing it.
Here are the MariaDB Versions I am using:
Hosting Server (Ubuntu): mariadb Ver 15.1 Distrib 10.6.18-MariaDB, for Linux (x86_64)
Local Server (Linux Mint): mariadb Ver 15.1 Distrib 10.6.16-MariaDB, for debian-linux-gnu (x86_64)
My PC using Ansible (Gentoo): mariadb Ver 15.1 Distrib 10.6.17-MariaDB, for Linux (x86_64)

My Local Server is up to date on upgrades, but the MariaDB version is not the same as the Hosting Server, hence the problem.

@yorkshire-pudding yorkshire-pudding changed the title Probelm exporting and importing Databases caused by MariaDB Dump File Compatibility Change Problem exporting and importing Databases caused by MariaDB Dump File Compatibility Change Jun 1, 2024
@yorkshire-pudding
Copy link
Collaborator

Thanks for sharing this here @TheMetMan . I had an issue a while ago where my host switched from MariaDB to MySQL:8 and I ended up having to drop the local, switch to MySQL then import from host.

I wonder, do you think there is anything bee needs to do better here, or is this just for information?

@TheMetMan
Copy link
Author

I don't think bee need to do anything @yorkshire-pudding, but I thought giving a 'Heads Up' might help someone else who hits this problem.

@TheMetMan
Copy link
Author

I have had another look at this. It would seem that if you are using MariaDB version 10.6.18 on any server the database will be exported with the header as above. This same version imports it, no problem.
It is when an older version tries to import it that there is a problem.
Fortunately my Local and Remote are now both on 10.6.18 so I no longer have the problem.
I will just have to keep an eye on the versions and make sure they continue to behave.....

@yorkshire-pudding
Copy link
Collaborator

I came across this and found another workaround.

Modify the local version of bee in commands/db.bee.inc

The line that says

    $import_command .= "$gunzip_bin -c $filename | ";

modified to:

    $import_command .= "$gunzip_bin -c $filename |  tail +2 | ";

I'll not change this in bee as it will break things where this isn't an issue. However, I'll look at a more sustainable change.

@yorkshire-pudding
Copy link
Collaborator

Need to do for unzipped .sql files too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment