Problem importing large database backup

My Mautic version is: 3.2.5
My PHP version is: 7.4
My Database type and version is: MariaDB 10.5

Your problem

I have a Mautic database that I exported for backup on cPanel because I wanted to upgrade the app. I got some error during the upgrade. Now I’m trying to import it back to phpmyadmin and it’s throwing me errors.

Everything was working great before trying to upgrade.

I’m doing the import through command line. It is a big database with around 4GB.

This is the error:

ERROR 1452 (23000) at line 18877179: Cannot add or update a child row: a foreign key constraint fails (zgmedi5_marketing_gdp.#sql-alter-74d1-722, CONSTRAINT FK_9EED7E6655458D FOREIGN KEY (lead_id) REFERENCES leads (id) ON DELETE CASCADE)

Steps I have tried to fix the problem:

  • I updated MariaDB from 10.2 to 10.5.
  • Created a clean database with the same name and tried to import it.
  • Tried to import via UI of phpmyadmin.