Error while importing demo database to mysql

I’m trying to import the OpenMRS demo database (large-demo-data-2-2-1) to my MySQL server (version 8.0.29 on Ubuntu 20). I’m using this command:

zcat ./large-demo-data-2-2-1.sql.gz | mysql -u ‘root’ -p openmrs

and I’m getting this error:

ERROR 3780 (HY000) at line 1653: Referencing column ‘edit_privilege’ and referenced column ‘privilege’ in foreign key constraint ‘privilege_which_can_edit_encounter_type’ are incompatible.

How can I fix this?

What is the output of the describe command for your encounter_type and privilege tables?

I just dropped the openmrs database, created another one, and tried again, and it worked.