MySQL 5.7
首先你要找到你的外鍵約束的名稱
如果你知道是哪個表的話:查看創建語句 show create table 表名
刪除外鍵命令:alter table 表名 drop foreign key 外鍵名;
刪除主鍵命令: alter table 表名 drop primary key;
添加外鍵約束:alter table 表名 add foreign key(字段名) references 表名(字段名)
先就記錄這些吧
MySQL 5.7
首先你要找到你的外鍵約束的名稱
如果你知道是哪個表的話:查看創建語句 show create table 表名
刪除外鍵命令:alter table 表名 drop foreign key 外鍵名;
刪除主鍵命令: alter table 表名 drop primary key;
添加外鍵約束:alter table 表名 add foreign key(字段名) references 表名(字段名)
先就記錄這些吧