Q009:升级过程中提示(1062) Duplicate entry '***' for key 'username'ALTER TABLE common_member CONVERT TO CHARACTER SET utf8mb4COLLATE utf8mb4_unicode_ci;(common_member也可能是common_member_archive)
A009:首先,这一般是UC升级1.7.0后UC里应用通信失败导致改名通知未被全部执行就进行了X程序升级引起的,解决方法有多种。
其一,完全恢复所有数据后,重新升级UC之后,进入UC后台,确保通信成功,且“数据列表-通知列表”中重命名用户通知全部成功,此时再执行X程序升级则无虞;
其二,进入数据库,执行语句:
select uid from pre_ucenter_members where username in (select username from pre_ucenter_members group by convert(username using utf8mb4) collate utf8mb4_unicode_ci having count(1) > 1)
再将异常用户改名,如果UC表查询无异常,上述语句中表名可以更换为(pre_common_member_archive)
其三,进入数据库,执行语句
update `pre_common_member` inner join `pre_ucenter_members` on `pre_common_member`.uid = `pre_ucenter_members`.uid set `pre_common_member`.username = `pre_ucenter_members`.username
和
update `pre_common_member_archive` inner join `pre_ucenter_members` on `pre_common_member_archive`.uid = `pre_ucenter_members`.uid set `pre_common_member_archive`.username = `pre_ucenter_members`.username