mysql字段结构变更+2个库的字段对拷

2016/08/20 mysql

字段结构变更

ALTER TABLE pre_ucenter_members MODIFY COLUMN username char(70) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ‘’ AFTER uid;

ALTER TABLE pre_common_member MODIFY COLUMN username char(70) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT ‘’ AFTER email;

ALTER TABLE pre_common_member MODIFY COLUMN loginname char(70) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL AFTER nickname;

2个库,互相更新字段

discuz库 update bbs_sj.pre_common_member old ,ibbs_x3.pre_common_member new set new.loginname=old.username where new.uid=old.uid;

update bbs_sj.pre_common_member old ,ibbs_x3.pre_common_member new set new.username=old.nickname where new.uid=old.uid;

uc库 update bbs_sj.pre_ucenter_members old ,ibbs_x3_uc.pre_ucenter_members new set new.username=old.username where new.uid=old.uid;


Search

    Table of Contents