MySQL set/cancel foreign key constraints

(1) Set foreign key constraints

alter table table name add foreign key (field name) references table name (field name)

Among them, the type and length of the two field names must be the same. If you can't set it, you can delete the record and try again.

(2) Cancel the foreign key constraint (set in the phpmyadmin table relationship)

select restrict

Constraint name must be empty

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324889937&siteId=291194637