wordpress转讯睿数据库,以下方法适用于简单的转移
PHP
0
wordpress转讯睿数据库,以下方法适用于简单的转移,适用于简单的转移,未转移关键词,图片等。以后有空再整理
在wordpressdb 创建相应的数据库名
第一步,将文章转到文章
INSERT INTO `dr_1_news`(`id`, `catid`, `title`, `thumb`, `keywords`, `description`, `hits`, `uid`, `author`, `status`, `url`, `link_id`, `tableid`, `inputip`, `inputtime`, `updatetime`, `displayorder`)
SELECT wp_posts.ID,
case when wp_terms.slug='xz' then '1'
when wp_terms.slug='cxy' then '2'
when wp_terms.slug='sh' then '7'
when wp_terms.slug='wj' then '8'
when wp_terms.slug='618' then '9'
else '1' end catid
,wp_posts.post_title,'','','',1,1,'角斗士',9,'', 0, 0, '127.0.0.1', UNIX_TIMESTAMP(wp_posts.post_date), UNIX_TIMESTAMP(wp_posts.post_date), 0
from wp_posts,wp_term_relationships,wp_term_taxonomy, wp_terms
where ID=object_id
and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND wp_terms.term_id=wp_term_taxonomy.term_id
and post_type="post"
and post_status = "publish"
and taxonomy = "category"
转完文章更新一下关键词。
update dr_1_news a inner join
(
SELECT wp_posts.ID,GROUP_CONCAT(wp_terms.name) gjc
from wp_posts,wp_term_relationships,wp_term_taxonomy, wp_terms
where ID=object_id
and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND wp_terms.term_id=wp_term_taxonomy.term_id
and post_type="post"
and post_status = "publish"
and taxonomy = "post_tag"
group by wp_posts.ID
) b on a.id=b.ID
set a.keywords=b.gjc
第二步,把内容转到对应的表格。
INSERT INTO `dr_1_news_data_0`(`id`, `uid`, `catid`, `content`)
SELECT wp_posts.ID,1,
case when wp_terms.slug='xz' then '1'
when wp_terms.slug='cxy' then '2'
when wp_terms.slug='sh' then '7'
when wp_terms.slug='wj' then '8'
when wp_terms.slug='618' then '9'
else '1' end catid
,wp_posts.post_content
from wp_posts,wp_term_relationships,wp_term_taxonomy, wp_terms
where ID=object_id
and wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id
AND wp_terms.term_id=wp_term_taxonomy.term_id
and post_type="post"
and post_status = "publish"
and taxonomy = "category"
转移过去。
INSERT INTO 讯睿数据库名.`dr_1_news`(`id`, `catid`, `title`, `thumb`, `keywords`, `description`, `hits`, `uid`, `author`, `status`, `url`, `link_id`, `tableid`, `inputip`, `inputtime`, `updatetime`, `displayorder`)
SELECT `id`, `catid`, `title`, `thumb`, `keywords`, `description`, `hits`, `uid`, `author`, `status`, `url`, `link_id`, `tableid`, `inputip`, `inputtime`, `updatetime`, `displayorder` from `wordpressdb`.`dr_1_news`
delete from `wordpressdb`.`dr_1_news_data_0`
INSERT INTO 讯睿数据库名.`dr_1_news_data_0`(`id`, `uid`, `catid`, `content`)
SELECT `id`, `uid`, `catid`, `content` from `wordpressdb`.`dr_1_news_data_0`
版权声明:除非特别标注原创,其它均来自互联网,转载时请以链接形式注明文章出处。