If, like me, you don't have command line access and can only do this through phpMyAdmin, you'll have to alter the method on the parent page. Here's how I did it.
This method is assuming that you've an old CiviCRM installation and a new, clean, CiviCRM installation, of the same version number, on a different server.
- Export the old database in its entirety from the old server. Let's call this sql file OLD_COMPLETE.sql.
- Export the old database without the following five tables. Let's call this sql file OLD_LESS_FIVE_TABLES.sql.
- On the new server, backup the 'clean' database, calling it, say, CLEAN_NEW_INSTALL.sql.
- On the new server, export the same five tables mentioned in step 2. Let's call this sql CLEAN_FIVE_TABLES.sql.
- Edit OLD_LESS_FIVE_TABLES.sql with a text editor (e.g. Notepad++ ) and delete all the constraint information at the bottom of the file.
- Edit CLEAN_FIVE_TABLES.sql with a text editor and delete all the constraint information at the bottom of the file.
- Open CLEAN_NEW_INSTALL.sql with a text editor and copy and paste all the constraint information at the bottom of the file into a new file, CONSTRAINTS.sql, say.
- Delete the contents of the database on the new server (select all tables and then 'drop' them as many times is needed until they're gone).
- Import OLD_LESS_FIVE_TABLES.sql and CLEAN_FIVE_TABLES.sql into the new database.
- Import CONSTRAINTS.sql into the new database.
- Now follow the instructions on the parent page from the step on clearing your cache onwards.
This should then work. Perhaps there's an easier way to do this in myPhpAdmin, but I kept getting foreign key constraints complaints any other way.