添加
alert table <外键表> add constraint `<外键关系名>` foreign key <外键> references <主键表>(<主键>) [on update cascade/set null/restrict/no action] [on delete cascade/set null/restrict/no action]
删除
alter table <外键表> drop foreign key `<外键关系名>`
alert table <外键表> add constraint `<外键关系名>` foreign key <外键> references <主键表>(<主键>) [on update cascade/set null/restrict/no action] [on delete cascade/set null/restrict/no action]
alter table <外键表> drop foreign key `<外键关系名>`