mysql:[Err] 1068 - Multiple primary key defined
添加主键时,出现错误:[Err] 1068 - Multiple primary key defined
#增加主键 alter table my_test add phone_number VARCHAR(30) not null; update my_test set phone_number=123456789; alter table my_test add primary key (phone_number); #[Err] 1068 - Multiple primary key defined
这是因为已经存在主键 (id) 了,需要先删除原来的主键,再设置新的主键
显示主键:
show keys from table_name; #显示主键