I’m currently developing a new database, requiring the initialisation code to be run over and over again. Creating tables with IF EXISTS is easy. Delete a foreign key if one had been created already was a little more problematic.

set @var=if((SELECT true FROM information_schema.TABLE_CONSTRAINTS WHERE
            TABLE_NAME        = 'table_name' AND
            CONSTRAINT_NAME   = 'fk_name' AND
            CONSTRAINT_TYPE   = 'FOREIGN KEY') = true,'ALTER TABLE table_name
            drop foreign key fk_name','select 1');

prepare stmt from @var;
execute stmt;
deallocate prepare stmt;