忽然发现,typecho里的id不叫id叫cid……原so来da如si此nei……

复制表,删除ID列(即cid):

CREATE TABLE new_table LIKE typecho_contents; ALTER TABLE new_table DROP COLUMN cid;

把原表数据复制到新表中,但不含ID列:

INSERT INTO new_table (title,slug,created,modified,text,authorId,template,type,status,password,commentsNum,allowComment,allowPing,allowFeed,parent,views) SELECT title,slug,created,modified,text,authorId,template,type,status,password,commentsNum,allowComment,allowPing,allowFeed,parent,views FROM typecho_contents;

增加ID列:

ALTER TABLE new_table ADD COLUMN cid INT AUTO_INCREMENT PRIMARY KEY FIRST;

改名字:

RENAME TABLE typecho_contents TO typecho_contents1, new_table TO typecho_contents;

我就不信征服不了你!!

找星铃丹聊个五毛

星铃丹Q群:86821220

星铃丹Q号:86821220

星铃丹微信:86821220