Blogger Information
Blog 8
fans 0
comment 0
visits 12235
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
MySQL中删除主键
杨家二少
Original
5698 people have browsed it

在MySQL中删除主键需要两步. 
1、如果有auto_increment,先删除之; 
2、删除主键约束 primary key.

例如: 
假设我们有个表member.里面的openid为主键,并且是自增长,我们需要删除其主键以及自增长。结构如下: 

(1)我们删除openid的auto_increment约束。

alter table member change openid openid int;

(2)删除openid 的primary key约束

alter table `member` drop primary key;


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post