背景:
wordpress安装时数据库指定不正确,导致网站上的数据都放到了mysql这个系统库中。
MysqL> show tables from MysqL;
+---------------------------+
| Tables_in_MysqL |
+---------------------------+
| columns_priv |
| db |
| event |
| func |
| general_log |
| help_category |
| help_keyword |
| help_relation |
| help_topic |
| host |
| ndb_binlog_index |
| plugin |
| proc |
| procs_priv |
| servers |
| slow_log |
| tables_priv |
| time_zone |
| time_zone_leap_second |
| time_zone_name |
| time_zone_transition |
| time_zone_transition_type |
| user |
| wp_commentMeta |
| wp_comments |
| wp_links |
| wp_options |
| wp_postMeta |
| wp_posts |
| wp_term_relationships |
| wp_term_taxonomy |
| wp_termMeta |
| wp_terms |
| wp_userMeta |
| wp_users |
+---------------------------+
而MysqL库中放的MysqL数据库自身的数据,所以我们希望把网站的数据重新放到wordpress库。
思路:
首先将MysqL库中属于wordpress的数据备份到/back/MysqL下,再把备份的数据恢复到wordpress库中。
操作:
第一步:写一个备份脚本
[root@localhost MysqL]# cat wp_backup.sh
for tname in ` MysqL -uroot -p'dong' -e "use MysqL;show tables like 'wp_%'"|grep -iv tables`
do
tname_all="$tname_all $tname"
done
#echo $tname_all
MysqLdump -uroot -p'dong' MysqL $tname_all >/backup/MysqL/wp_all_back.sql
第二步:验证脚本的正确性后,执行脚本
第三步:将备份的数据恢复到wordpress库中
第五步:验证结果
MysqL> show tables from wordpress ;
+-----------------------+
| Tables_in_wordpress |
+-----------------------+
| wp_commentMeta |
| wp_comments |
| wp_links |
| wp_options |
| wp_postMeta |
| wp_posts |
| wp_term_relationships |
| wp_term_taxonomy |
| wp_termMeta |
| wp_terms |
| wp_userMeta |
| wp_users |
+-----------------------+
12 rows in set (0.00 sec)
最后网站也运行正常,结束。
更多博客请访问:www.ayard.com.cn
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。