• 织梦cms DEDECMS 数据本地备份为空 服务器无法还原(MYSQL版本问题)


    本地备份后上传到服务器,还原是空白。解决办法:

    1:登陆本地phpmyadmin,导出数据为.sql.zip格式。
    2:服务器端phpmyadmin,导入.sql.zip
    3:修改文件:/dede/sys_data_done.php 如下 步骤,然后服务器端即可正常备份、还原了。

    织梦运行在PHP7环境中,备份数据之后的txt文件是空命令,大致空命令如:

    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    
    

    这是官方最新程序还没有全面支持PHP7,很多地方的代码写的不够严谨导致的,要么降低你的PHP版本,要么自己动手修复这个BUG

    打开 /dede/sys_data_done.php 找到

    $fs = $bakStr = '';
    

    改成

    $fs = array();$bakStr = '';
    

    保存,再去备份一次数据看看,现在备份的数据就不是空的了吧,下面你就可以去还原数据库了。

    在新安装的程序更改数据库前缀

    1.正常执行织梦安装程序,记住安装时候的数据库前缀即可,

    2.批量修改数据备份文件中的数据表名,如:

    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    

    修改为

    INSERT INTO `dede_demo6_addonarticle` VALUES('','','','','','','');
    

    3.执行数据还原操作。

    注:数据备份的文件名不重要,重要的是txt文件里面的数据表前缀一定要和上面第一步安装时候的数据表前缀一样才行,否则这个新程序链接的数据库就不是备份文件的数据了,切记!!!

    修改当前程序的数据库前缀

    1.正常执行备份数据操作

    2.找到datacommon.inc.php,选中打开,修改代码,将 dede_demo3_ 这个代表的是当前数据库表前缀,修改成你需要的新数据表前缀 dede_demo6_

    <?php
    //数据库连接信息
    $cfg_dbtype = 'mysql';
    $cfg_dbhost = 'localhost';
    $cfg_dbname = 'dedecmsv57utf8sp2';
    $cfg_dbuser = 'root';
    $cfg_dbpwd = 'root';
    $cfg_dbprefix = 'dede_demo3_';
    $cfg_db_language = 'utf8';
    
    
    ?>
    

    3.批量修改第一步刚刚数据备份文件中的数据表名,如:

    INSERT INTO `dede_demo3_addonarticle` VALUES('','','','','','','');
    

    修改为

    INSERT INTO `dede_demo6_addonarticle` VALUES('','','','','','','');
    

    4.执行数据还原操作。

    注:数据备份的文件名不重要,重要的是txt文件里面的数据表前缀一定要和上面第一步安装时候的数据表前缀一样才行,否则这个新程序链接的数据库就不是备份文件的数据了,切记!!!

  • 相关阅读:
    R中seurat等问题学习
    主成分分析PCA学习一条龙
    PAT 1116 Come on! Let's C [简单]
    PAT 1077 Kuchiguse [一般]
    R中的一些基础1106
    PAT 1036 Boys vs Girls[简单]
    稳定婚姻匹配问题模板
    University Entrace Examination zoj1023
    Stable Match
    7-1 玩转二叉树
  • 原文地址:https://www.cnblogs.com/jiaoshou/p/14238116.html
Copyright © 2020-2023  润新知