1.查看数据库表创建的sql语句
show create table vip
2.查看外键的约束名
CREATE TABLE `vip` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`address` varchar(255) DEFAULT NULL,
`code` varchar(255) DEFAULT NULL,
`mobile` varchar(255) DEFAULT NULL,
`name` varchar(255) DEFAULT NULL,
`score` int(11) DEFAULT NULL,
`id_code` varchar(255) DEFAULT NULL,
`user_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `FK1C81D1738DA76` (`user_id`),
CONSTRAINT `FK1C81D1738DA76` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8
3.解除外键约束
alter table vip drop foreign key FK1C81D1738DA76
4.删除外键
alter table vip drop user_id
感谢您的支持,写的文章如对您有所帮助,开源不易,请您打赏,谢谢啦~