将.sql数据库迁移到WordPress

时间:2018-01-12 17:52:07

标签: mysql sql database wordpress database-migration

我有一个来自旧自定义博客CMS的数据库的SQL文件。我试图将文章导入WordPress但我现在卡住了。到目前为止,我已设法隔离CMS的表结构(见下文)。我还确定了我需要的列。这些是(帖子,标题,日期,图像,类别)。现在我必须以某种方式将这些列映射到Wordpress架构中的某些列,这就是我遇到的问题。

这是数据库的SQL结构:

CREATE TABLE `ads_ng_ads` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `ad_type` enum('media','text','html') character set latin1 collate latin1_bin NOT NULL,
  `media_type` enum('image','flash','other') character set latin1 collate latin1_bin default NULL,
  `media_width` smallint(6) default NULL,
  `media_height` smallint(6) default NULL,
  `media_size` int(6) default NULL,
  `media_path` varchar(128) character set latin1 collate latin1_bin default NULL,
  `uri` varchar(128) character set utf8 collate utf8_bin NOT NULL,
  `is_hidden` tinyint(1) NOT NULL,
  `created_on` int(11) NOT NULL,
  `active_from` int(11) NOT NULL,
  `active_to` int(11) NOT NULL,
  `room_id` int(11) default NULL,
  `geo_target` int(11) default NULL,
  `alternative` text character set utf8 NOT NULL,
  `zone_target` text character set ascii collate ascii_bin NOT NULL,
  `uri_target` text character set utf8 collate utf8_bin NOT NULL,
  PRIMARY KEY  (`id`),
  KEY `zone_target` (`is_hidden`,`active_from`,`active_to`,`geo_target`)
) ENGINE=MyISAM AUTO_INCREMENT=757 DEFAULT CHARSET=latin1;


CREATE TABLE `ads_ng_statistics` (
  `ad_id` int(10) unsigned NOT NULL,
  `date` int(11) NOT NULL,
  `views` mediumint(8) unsigned NOT NULL default '0',
  `clicks` mediumint(8) unsigned NOT NULL default '0',
  PRIMARY KEY  (`ad_id`,`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;




CREATE TABLE `countries` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(100) NOT NULL,
  `alias` varchar(3) NOT NULL,
  `restricted` tinyint(3) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=253 DEFAULT CHARSET=utf8;


CREATE TABLE `featured_column` (
  `id` int(11) unsigned NOT NULL auto_increment,
  `date_modified` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `date_created` timestamp NOT NULL default '1000-01-01 00:00:00',
  `title` varchar(255) NOT NULL,
  `alias` varchar(255) NOT NULL,
  `body` text NOT NULL,
  `body_html` text NOT NULL,
  `user_id` int(11) NOT NULL,
  `tags` varchar(255) NOT NULL,
  `summary` varchar(255) NOT NULL,
  `in_homepage` int(1) NOT NULL default '0',
  `img_title` int(1) NOT NULL default '0',
  `meta_t` varchar(255) NOT NULL,
  `meta_k` varchar(255) NOT NULL,
  `meta_d` varchar(255) NOT NULL,
  `public` int(1) NOT NULL default '0',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1381 DEFAULT CHARSET=utf8;

1 个答案:

答案 0 :(得分:0)

假设您正在使用最新的WordPress版本(4.9.1),您只需要创建一个脚本,将所有数据导入到表wp_posts中,例如,如果您要导入WordPress帖子。示例:"标题" to" post_title"," post" to" post_content"等 WordPress wp_posts table