Skip to content

[4.x]: DB export/import error #14648

@Michael-Paragonn

Description

@Michael-Paragonn

What happened?

Description

After a server change, I can no longer import the DB dumps generated by Craft 4 on the new server into my local DDEV instance. I reported the issue to DDEV here, but the permissions-adjustment fix mentioned no longer works (or perhaps I'm just doing it wrong), and since the workaround my sysadmin has been using is done at the export end (exporting using --set-gtid-purged=OFF), and not the import end, I thought perhaps there's something Craft could be on the lookout for to prevent this from happening.

Here's the error when I try to import using ddev craft db/restore:

michael@Mike-PC:~/projects/myProject/htdocs$ ddev craft db/restore ./myProject--2024-03-22-073722--v4.8.0.sql 
Restoring database backup ... error: The shell command "mysql --defaults-file="/tmp/uodulpokkula.cnf" db < "./myProject--2024-03-22-073722--v4.8.0.sql"" failed with exit code 1: ERROR 3546 (HY000) at line 24: @@GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED
Failed to run craft db/restore ./myProject--2024-03-22-073722--v4.8.0.sql: exit status 1

And here's the error when I try to import using DDEV's ddev import-db:

michael@Mike-PC:~/projects/myProject/htdocs$ ddev import-db < ./myProject--2024-03-22-073722--v4.8.0.sql 
mysql: [Warning] Using a password on the command line interface can be insecure. 
ERROR 3546 (HY000) at line 24: @@GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED 
Failed to import database db for myproject: failed to import database: ComposeCmd failed to run 'COMPOSE_PROJECT_NAME=ddev-myproject docker-compose -f /home/michael/projects/myProject/htdocs/.ddev/.ddev-docker-compose-full.yaml exec -T db bash -c set -eu -o pipefail && mysql -uroot -proot -e "DROP DATABASE IF EXISTS db; CREATE DATABASE IF NOT EXISTS db; GRANT ALL ON db.* TO 'db'@'%';" && perl -p -e 's/^(CREATE DATABASE \/\*|USE `)[^;]*;//' | mysql db', action='[exec -T db bash -c set -eu -o pipefail && mysql -uroot -proot -e "DROP DATABASE IF EXISTS db; CREATE DATABASE IF NOT EXISTS db; GRANT ALL ON db.* TO 'db'@'%';" && perl -p -e 's/^(CREATE DATABASE \/\*|USE `)[^;]*;//' | mysql db]', err='exit status 1', stdout='', stderr='mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 3546 (HY000) at line 24: @@GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED'
stdout: 
stderr: mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 3546 (HY000) at line 24: @@GLOBAL.GTID_PURGED cannot be changed: the added gtid set must not overlap with @@GLOBAL.GTID_EXECUTED 

Steps to reproduce

  1. Export a database from Craft on a server that causes this issue. (🤷)
  2. Try to import the database into a local DDEV instance.

Expected behavior

The database imports without problems.

Actual behavior

The database doesn't import because of some GTID-related problem with the export.

Craft CMS version

4.8.0

PHP version

8.1

Operating system and version

Windows 11 + WSL2 + DDEV

Database type and version

MySQL 8.0

Image driver and version

No response

Installed plugins and versions

  • Architect 4.0.1
  • Asset Rev 7.0.0
  • Color Mixer 3.0.0
  • DigitalOcean Spaces Filesystem 2.0.0
  • Feed Me 5.4.0
  • Field Manager 3.0.8
  • Freeform 4.1.13
  • Image Resizer 3.0.11
  • Inventory 3.1.1
  • Linkit 4.0.4.1
  • Logs 4.0.0
  • Maps 4.0.4
  • Mix 1.6.0
  • Postmark 3.0.0
  • Redactor 3.0.4
  • SEO 4.2.2
  • Simple Text 3.0.0
  • Super Table 3.0.12
  • Table Maker 4.0.7

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions