正义潘恩 发表于 2023-9-7 22:41:12

Discuz X3.4 用户表 主表 存档表 数据合并

1,登录后台,工具,计划任务,取消勾选 每日用户表优化
2,关闭站点,备份数据库,如果可以,全站备份更好
3,不要手贱去点 后台,站长,用户表优化
4,打开你的MYSQL管理工具,比如 phpMyAdmin
几个受影响需要更改的表
pre_common_member
pre_common_member_archive
pre_common_member_count
pre_common_member_count_archive
pre_common_member_field_forum
pre_common_member_field_forum_archive
pre_common_member_field_home
pre_common_member_field_home_archive
pre_common_member_profile
pre_common_member_profile_archive
pre_common_member_status
pre_common_member_status_archive
5,看一下上面数据库中的几个表,受影响了几个,受影响的都要修改
打开 pre_common_member_archive
删除重复内容
ALTER IGNORE TABLE pre_common_member_archive ADD UNIQUE INDEX(`uid`)
ALTER IGNORE TABLE pre_common_member_archive ADD UNIQUE INDEX(`uid`)
全选代码复制
把 pre_common_member_archive 内容复制到 pre_common_member
insert into pre_common_member select * from pre_common_member_archive
insert into pre_common_member select * from pre_common_member_archive
全选代码复制
若没有找到执行语句的输入窗口 则修改
config/config_global.php
当中的
$_config 设置修改为 1
(为了安全执行完该语句后 确认解决了1146错误后 再将配置该回来 ) 刷新后再输入执行。
后台,站长,数据库,升级
insert into pre_common_member select * from pre_common_member_archive;
insert into pre_common_member_count select * from pre_common_member_count_archive;
insert into pre_common_member_field_forum select * from pre_common_member_field_forum_archive;
insert into pre_common_member_field_home select * from pre_common_member_field_home_archive;
insert into pre_common_member_profile select * from pre_common_member_profile_archive;
insert into pre_common_member_status select * from pre_common_member_status_archive;insert into pre_common_member_count select * from pre_common_member_count_archive;
insert into pre_common_member_field_forum select * from pre_common_member_field_forum_archive;
insert into pre_common_member_field_home select * from pre_common_member_field_home_archive;
insert into pre_common_member_profile select * from pre_common_member_profile_archive;
insert into pre_common_member_status select * from pre_common_member_status_archive;
全选代码复制
以上六条的意思就是把六个存档表中的东西合并到主表中。
然后再使用如下升级数据库:
TRUNCATE TABLE`pre_common_member_archive`;
TRUNCATE TABLE`pre_common_member_count_archive`;
TRUNCATE TABLE`pre_common_member_field_forum_archive`;
TRUNCATE TABLE`pre_common_member_field_home_archive`;
TRUNCATE TABLE`pre_common_member_profile_archive`;
TRUNCATE TABLE`pre_common_member_status_archive`;
TRUNCATE TABLE`pre_common_member_archive`;
TRUNCATE TABLE`pre_common_member_count_archive`;
TRUNCATE TABLE`pre_common_member_field_forum_archive`;
TRUNCATE TABLE`pre_common_member_field_home_archive`;
TRUNCATE TABLE`pre_common_member_profile_archive`;
TRUNCATE TABLE`pre_common_member_status_archive`;全选代码复制
以上六条的意思就是把六个存档表数据全部清空。

页: [1]
查看完整版本: Discuz X3.4 用户表 主表 存档表 数据合并