1.如果已有主键要先清除现有主键
ALTER TABLE yourtable
DROP PRIMARY KEY;
PS:如果你的主键是自增的,要先去除自增特性 才能去除主键
2. 创建复合主键
ALTER TABLE yourtable
ADD PRIMARY KEY (employeeid, recordmonth, recordyear);
标签:自增,yourtable,PRIMARY,主键,多字段,MySql,TABLE,ALTER
来源: https://www.cnblogs.com/wkk2020/p/15715134.html