Home > Article > Backend Development > wordpress-4.4.1 Database table structure analysis, wordpress database structure_PHP tutorial
wordpress-4.4.1.zip installation package
SQL structure:
wp_commentmeta: Article comment additional information table.
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_commentmeta` ( `meta_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `comment_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `meta_key` </span><span>varchar</span>(<span>255</span>) <span>DEFAULT</span> <span>NULL</span><span>, `meta_value` longtext, </span><span>PRIMARY</span> <span>KEY</span><span> (`meta_id`), </span><span>KEY</span><span> `comment_id` (`comment_id`), </span><span>KEY</span> `meta_key` (`meta_key`(<span>191</span><span>)) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>1</span> ;
wp_comments: Article comment information table.
comment_ID – The unique ID number of each comment, which is a bigint(20) value. With additional attribute auto_increment.
comment_post_ID – The ID number of the article corresponding to each comment, int (11) value, equivalent to wp_posts.ID.
comment_author – commenter name for each comment, tinytext value.
comment_author_email – The commenter’s email address for each comment, varchar(100) value.
comment_author_url – The commenter URL of each comment, varchar(200) value.
comment_author_IP – The commenter’s IP address for each comment, varchar(100) value.
comment_date – The time when each comment was published, datetime value (the value after adding the time zone offset).
comment_date_gmt – The time when each comment was published, datetime value (standard Greenwich time).
comment_content – the specific content of each comment, text value.
comment_karma – unknown, int(11) value, default is 0.
comment_approved – The current status of each comment is an enumeration value enum(’0′,’1′,’spam’), 0 is waiting for review, 1 is allowed to be published, and spam is a spam comment. The default value is 1.
comment_agent – The client information of the commenter of each comment, varchar(255) value, mainly including the type, version and other information of the browser and operating system.
comment_type – Type of comment, varchar(20) value.
comment_parent – The parent comment of a certain comment, int(11) value, corresponding to wp_comment.ID, the default is 0, that is, there is no parent comment.
user_id – the user ID corresponding to a certain comment, which will only be generated after the user registers. The int (11) value corresponds to wp_users.ID. For unregistered users, i.e. external commenters, the value of this ID is 0.
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_comments` ( `comment_ID` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `comment_post_ID` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `comment_author` tinytext </span><span>NOT</span> <span>NULL</span><span>, `comment_author_email` </span><span>varchar</span>(<span>100</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `comment_author_url` </span><span>varchar</span>(<span>200</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `comment_author_IP` </span><span>varchar</span>(<span>100</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `comment_date` </span><span>datetime</span> <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0000-00-00 00:00:00</span><span>'</span><span>, `comment_date_gmt` </span><span>datetime</span> <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0000-00-00 00:00:00</span><span>'</span><span>, `comment_content` </span><span>text</span> <span>NOT</span> <span>NULL</span><span>, `comment_karma` </span><span>int</span>(<span>11</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `comment_approved` </span><span>varchar</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>1</span><span>'</span><span>, `comment_agent` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `comment_type` </span><span>varchar</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `comment_parent` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `</span><span>user_id</span>` <span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, </span><span>PRIMARY</span> <span>KEY</span><span> (`comment_ID`), </span><span>KEY</span><span> `comment_post_ID` (`comment_post_ID`), </span><span>KEY</span><span> `comment_approved_date_gmt` (`comment_approved`,`comment_date_gmt`), </span><span>KEY</span><span> `comment_date_gmt` (`comment_date_gmt`), </span><span>KEY</span><span> `comment_parent` (`comment_parent`), </span><span>KEY</span> `comment_author_email` (`comment_author_email`(<span>10</span><span>)) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>2</span> ;
wp_links: Table used to save links entered by users into WordPress.
link_id – The unique ID number of each link, bigint(20) value, additional attribute is auto_increment.
link_url – The URL address of each link, varchar(255) value, in the form of an address beginning with http://.
link_name – the name of a single link, varchar(255) value.
link_image – A link can be defined as using an image link. This field is used to save the address of the image and is a varchar(255) value.
link_target – There are three ways to open the link. _blank means opening it in a new window, _top means opening it in this window and at the top level, and none means not selecting it and it will open it in this window. This field is a varchar(25) value.
link_category – The link category corresponding to a link, which is an int(11) value. Equivalent to wp_linkcategories.cat_id.
link_description – Description text of the link. The user can choose to display it below the link or in the title attribute. varchar(255) value.
link_visible – Whether the link is visible, enumeration enum(’Y’,’N’) value, the default is Y, which is visible.
link_owner – The creator of a link, an int(11) value, the default is 1. (It should correspond to wp_users.ID)
link_rating – the link’s rating, int(11) value. Default is 0.
link_updated – the time when the link was defined or modified, datetime value.
link_rel – the relationship between the link and the definer, set by XFN Creator, varchar(255) value.
link_notes – detailed description of the link, mediumtext value.
link_rss – the RSS address of the link, varchar(255) value.
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_links` ( `link_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `link_url` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `link_name` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `link_image` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `link_target` </span><span>varchar</span>(<span>25</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `link_description` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `link_visible` </span><span>varchar</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>Y</span><span>'</span><span>, `link_owner` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>1</span><span>'</span><span>, `link_rating` </span><span>int</span>(<span>11</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `link_updated` </span><span>datetime</span> <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0000-00-00 00:00:00</span><span>'</span><span>, `link_rel` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `link_notes` mediumtext </span><span>NOT</span> <span>NULL</span><span>, `link_rss` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, </span><span>PRIMARY</span> <span>KEY</span><span> (`link_id`), </span><span>KEY</span><span> `link_visible` (`link_visible`) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>1</span> ;
wp_options: Table used to save WordPress related settings and parameters. The basic configuration information table is usually operated through get_option. This table is usually used as a place for plug-ins to store data. Is a data table used to store all global options in WordPress.
option_id – ID of the option, bigint(20) value, additional auto_increment attribute.
option_name – option name, varchar(64) value.
option_value – the value of the option, longtext value.
autoload – Whether the option is automatically loaded every time, enumeration ('yes', 'no') value, the default is yes.
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_options` ( `option_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `option_name` </span><span>varchar</span>(<span>191</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `option_value` longtext </span><span>NOT</span> <span>NULL</span><span>, `autoload` </span><span>varchar</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>yes</span><span>'</span><span>, </span><span>PRIMARY</span> <span>KEY</span><span> (`option_id`), </span><span>UNIQUE</span> <span>KEY</span><span> `option_name` (`option_name`) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>156</span> ;
wp_postmeta: Table used to save meta information (meta) of articles. Additional data tables for the article, such as the number of article views, custom fields of the article, etc. are stored here.
meta_id – Meta information ID, bigint(20) value, additional attribute is auto_increment.
post_id – post ID, bigint(20) value, equivalent to wp_posts.ID.
meta_key – Keyword of meta information, varchar(255) value.
meta_value – 元信息的值,text值。
这 些内容主要是在文章及页面编辑页(Write Post, Write Page)的”Add a new custom field to this post(page):”下进行设定的。meta_key就对应名为”key”的下拉列表中的项,而值由用户自己填上(某些时候,wp也会自动加入,如文 章中有的音频媒体)。
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_postmeta` ( `meta_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `post_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `meta_key` </span><span>varchar</span>(<span>255</span>) <span>DEFAULT</span> <span>NULL</span><span>, `meta_value` longtext, </span><span>PRIMARY</span> <span>KEY</span><span> (`meta_id`), </span><span>KEY</span><span> `post_id` (`post_id`), </span><span>KEY</span> `meta_key` (`meta_key`(<span>191</span><span>)) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>2</span> ;
<span>INSERT</span> <span>INTO</span> `wp_postmeta` (`meta_id`, `post_id`, `meta_key`, `meta_value`) <span>VALUES</span><span> (</span><span>1</span>, <span>2</span>, <span>'</span><span>_wp_page_template</span><span>'</span>, <span>'</span><span>default</span><span>'</span>);
wp_posts: 用于保存你所有的文章(posts)的相关信息的表。文章信息表,包括了日志、附件、页面等等信息,是WordPress最重要的一个数据表。
ID – 每篇文章的唯一ID,bigint(20)值,附加属性auto_increment。
post_author – 每篇文章的作者的编号,int(4)值,应该对应的是wp_users.ID。
post_date – 每篇文章发表的时间,datetime值。它是GMT时间加上时区偏移量的结果。
post_date_gmt – 每篇文章发表时的GMT(格林威治)时间,datetime值。
post_content – 每篇文章的具体内容,longtext值。你在后台文章编辑页面中写入的所有内容都放在这里。
post_title – 文章的标题,text值。
post_category – 文章所属分类,int(4)值。
post_excerpt – 文章摘要,text值。
post_status – 文章当前的状态,枚举enum(’publish’,’draft’,’private’,’static’,’object’)值,publish为已 发表,draft为草稿,private为私人内容(不会被公开) ,static(不详),object(不详)。默认为publish。
comment_status – 评论设置的状态,也是枚举enum(’open’,’closed’,’registered_only’)值,open为允许评论,closed为不允 许评论,registered_only为只有注册用户方可评论。默认为open,即人人都可以评论。
ping_status – ping状态,枚举enum(’open’,’closed’)值,open指打开pingback功能,closed为关闭。默认值是open。
post_password – 文章密码,varchar(20)值。文章编辑才可为文章设定一个密码,凭这个密码才能对文章进行重新强加或修改。
post_name – 文章名,varchar(200)值。这通常是用在生成permalink时,标识某篇文章的一段文本或数字,也即post slug。
to_ping – 强制该文章去ping某个URI。text值。
pinged – 该文章被pingback的历史记录,text值,为一个个的URI。
post_modified – 文章最后修改的时间,datetime值,它是GMT时间加上时区偏移量的结果。
post_modified_gmt – 文章最后修改的GMT时间,datetime值。
post_content_filtered – 不详,text值。
post_parent – 文章的上级文章的ID,int(11)值,对应的是wp_posts.ID。默认为0,即没有上级文章。
guid – 这是每篇文章的一个地址,varchar(255)值。默认是这样的形式: http://your.blog.site/?p=1,如果你形成permalink功能,则通常会是: 你的Wordpress站点地址+文章名。
menu_order – 不详,int(11)值,默认为0。
post_type – 文章类型,具体不详,varchar(100)值。默认为0。
post_mime_type – 不详。varchar(100)值。
comment_count – 评论计数,具体用途不详,bigint(20)值。
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_posts` ( `ID` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `post_author` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `post_date` </span><span>datetime</span> <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0000-00-00 00:00:00</span><span>'</span><span>, `post_date_gmt` </span><span>datetime</span> <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0000-00-00 00:00:00</span><span>'</span><span>, `post_content` longtext </span><span>NOT</span> <span>NULL</span><span>, `post_title` </span><span>text</span> <span>NOT</span> <span>NULL</span><span>, `post_excerpt` </span><span>text</span> <span>NOT</span> <span>NULL</span><span>, `post_status` </span><span>varchar</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>publish</span><span>'</span><span>, `comment_status` </span><span>varchar</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>open</span><span>'</span><span>, `ping_status` </span><span>varchar</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>open</span><span>'</span><span>, `post_password` </span><span>varchar</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `post_name` </span><span>varchar</span>(<span>200</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `to_ping` </span><span>text</span> <span>NOT</span> <span>NULL</span><span>, `pinged` </span><span>text</span> <span>NOT</span> <span>NULL</span><span>, `post_modified` </span><span>datetime</span> <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0000-00-00 00:00:00</span><span>'</span><span>, `post_modified_gmt` </span><span>datetime</span> <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0000-00-00 00:00:00</span><span>'</span><span>, `post_content_filtered` longtext </span><span>NOT</span> <span>NULL</span><span>, `post_parent` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `guid` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `menu_order` </span><span>int</span>(<span>11</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `post_type` </span><span>varchar</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>post</span><span>'</span><span>, `post_mime_type` </span><span>varchar</span>(<span>100</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `comment_count` </span><span>bigint</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, </span><span>PRIMARY</span> <span>KEY</span><span> (`ID`), </span><span>KEY</span> `post_name` (`post_name`(<span>191</span><span>)), </span><span>KEY</span><span> `type_status_date` (`post_type`,`post_status`,`post_date`,`ID`), </span><span>KEY</span><span> `post_parent` (`post_parent`), </span><span>KEY</span><span> `post_author` (`post_author`) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>5</span> ;
<span>INSERT</span> <span>INTO</span> `wp_posts` (`ID`, `post_author`, `post_date`, `post_date_gmt`, `post_content`, `post_title`, `post_excerpt`, `post_status`, `comment_status`, `ping_status`, `post_password`, `post_name`, `to_ping`, `pinged`, `post_modified`, `post_modified_gmt`, `post_content_filtered`, `post_parent`, `guid`, `menu_order`, `post_type`, `post_mime_type`, `comment_count`) <span>VALUES</span><span> (</span><span>1</span>, <span>1</span>, <span>'</span><span>2016-04-03 08:48:29</span><span>'</span>, <span>'</span><span>2016-04-03 00:48:29</span><span>'</span>, <span>'</span><span>欢迎使用WordPress。这是您的第一篇文章。编辑或删除它,然后开始写作吧!</span><span>'</span>, <span>'</span><span>世界,您好!</span><span>'</span>, <span>''</span>, <span>'</span><span>publish</span><span>'</span>, <span>'</span><span>open</span><span>'</span>, <span>'</span><span>open</span><span>'</span>, <span>''</span>, <span>'</span><span>hello-world</span><span>'</span>, <span>''</span>, <span>''</span>, <span>'</span><span>2016-04-03 08:48:29</span><span>'</span>, <span>'</span><span>2016-04-03 00:48:29</span><span>'</span>, <span>''</span>, <span>0</span>, <span>'</span><span>http://localhost:8081/?p=1</span><span>'</span>, <span>0</span>, <span>'</span><span>post</span><span>'</span>, <span>''</span>, <span>1</span><span>), (</span><span>2</span>, <span>1</span>, <span>'</span><span>2016-04-03 08:48:29</span><span>'</span>, <span>'</span><span>2016-04-03 00:48:29</span><span>'</span>, <span>'</span><span>这是一个范例页面。它和博客文章不同,因为它的页面位置是固定的,同时会显示于您的博客导航栏(大多数主题中)。大多数人会新增一个“关于”页面向访客介绍自己。它可能类似下面这样:\n\n<blockquote>我是一个很有趣的人,我创建了工厂和庄园。并且,顺便提一下,我的妻子也很好。</blockquote>\n\n……或下面这样:\n\n<blockquote>XYZ装置公司成立于1971年,公司成立以来,我们一直向市民提供高品质的装置。我们位于北京市,有超过2,000名员工,对北京市有着相当大的贡献。</blockquote>\n\n作为一个新的WordPress用户,您可以前往<a href="http://localhost:8081/wp-admin/">您的仪表盘</a>删除这个页面,并建立属于您的全新内容。祝您使用愉快!</span><span>'</span>, <span>'</span><span>示例页面</span><span>'</span>, <span>''</span>, <span>'</span><span>publish</span><span>'</span>, <span>'</span><span>closed</span><span>'</span>, <span>'</span><span>open</span><span>'</span>, <span>''</span>, <span>'</span><span>sample-page</span><span>'</span>, <span>''</span>, <span>''</span>, <span>'</span><span>2016-04-03 08:48:29</span><span>'</span>, <span>'</span><span>2016-04-03 00:48:29</span><span>'</span>, <span>''</span>, <span>0</span>, <span>'</span><span>http://localhost:8081/?page_id=2</span><span>'</span>, <span>0</span>, <span>'</span><span>page</span><span>'</span>, <span>''</span>, <span>0</span><span>), (</span><span>3</span>, <span>1</span>, <span>'</span><span>2016-04-03 08:58:06</span><span>'</span>, <span>'</span><span>0000-00-00 00:00:00</span><span>'</span>, <span>''</span>, <span>'</span><span>自动草稿</span><span>'</span>, <span>''</span>, <span>'</span><span>auto-draft</span><span>'</span>, <span>'</span><span>open</span><span>'</span>, <span>'</span><span>open</span><span>'</span>, <span>''</span>, <span>''</span>, <span>''</span>, <span>''</span>, <span>'</span><span>2016-04-03 08:58:06</span><span>'</span>, <span>'</span><span>0000-00-00 00:00:00</span><span>'</span>, <span>''</span>, <span>0</span>, <span>'</span><span>http://localhost:8081/?p=3</span><span>'</span>, <span>0</span>, <span>'</span><span>post</span><span>'</span>, <span>''</span>, <span>0</span><span>), (</span><span>4</span>, <span>1</span>, <span>'</span><span>2016-04-03 09:00:50</span><span>'</span>, <span>'</span><span>0000-00-00 00:00:00</span><span>'</span>, <span>''</span>, <span>'</span><span>自动草稿</span><span>'</span>, <span>''</span>, <span>'</span><span>auto-draft</span><span>'</span>, <span>'</span><span>open</span><span>'</span>, <span>'</span><span>open</span><span>'</span>, <span>''</span>, <span>''</span>, <span>''</span>, <span>''</span>, <span>'</span><span>2016-04-03 09:00:50</span><span>'</span>, <span>'</span><span>0000-00-00 00:00:00</span><span>'</span>, <span>''</span>, <span>0</span>, <span>'</span><span>http://localhost:8081/?p=4</span><span>'</span>, <span>0</span>, <span>'</span><span>post</span><span>'</span>, <span>''</span>, <span>0</span>);
wp_termmeta :分类与文章信息表(wp_posts)、链接表(wp_links)的关联表。
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_termmeta` ( `meta_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `term_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `meta_key` </span><span>varchar</span>(<span>255</span>) <span>DEFAULT</span> <span>NULL</span><span>, `meta_value` longtext, </span><span>PRIMARY</span> <span>KEY</span><span> (`meta_id`), </span><span>KEY</span><span> `term_id` (`term_id`), </span><span>KEY</span> `meta_key` (`meta_key`(<span>191</span><span>)) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>1</span> ;
wp_terms :文章分类、链接分类、标签的信息表。
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_terms` ( `term_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `name` </span><span>varchar</span>(<span>200</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `slug` </span><span>varchar</span>(<span>200</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `term_group` </span><span>bigint</span>(<span>10</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, </span><span>PRIMARY</span> <span>KEY</span><span> (`term_id`), </span><span>KEY</span> `slug` (`slug`(<span>191</span><span>)), </span><span>KEY</span> `name` (`name`(<span>191</span><span>)) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>2</span> ;
<span>INSERT</span> <span>INTO</span> `wp_terms` (`term_id`, `name`, `slug`, `term_group`) <span>VALUES</span><span> (</span><span>1</span>, <span>'</span><span>未分类</span><span>'</span>, <span>'</span><span>uncategorized</span><span>'</span>, <span>0</span>);
wp_term_relationships :分类与文章信息表(wp_posts)、链接表(wp_links)的关联表。
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_term_relationships` ( `</span><span>object_id</span>` <span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `term_taxonomy_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `term_order` </span><span>int</span>(<span>11</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, </span><span>PRIMARY</span> <span>KEY</span> (`<span>object_id</span><span>`,`term_taxonomy_id`), </span><span>KEY</span><span> `term_taxonomy_id` (`term_taxonomy_id`) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8;
wp_term_taxonomy :分类信息表,区分wp_terms信息的分类类型,有category、link_category和tag三种分类类型。
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_term_taxonomy` ( `term_taxonomy_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `term_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `taxonomy` </span><span>varchar</span>(<span>32</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `description` longtext </span><span>NOT</span> <span>NULL</span><span>, `parent` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `</span><span>count</span>` <span>bigint</span>(<span>20</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, </span><span>PRIMARY</span> <span>KEY</span><span> (`term_taxonomy_id`), </span><span>UNIQUE</span> <span>KEY</span><span> `term_id_taxonomy` (`term_id`,`taxonomy`), </span><span>KEY</span><span> `taxonomy` (`taxonomy`) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>2</span> ;
<span>INSERT</span> <span>INTO</span> `wp_term_taxonomy` (`term_taxonomy_id`, `term_id`, `taxonomy`, `description`, `parent`, `<span>count</span>`) <span>VALUES</span><span> (</span><span>1</span>, <span>1</span>, <span>'</span><span>category</span><span>'</span>, <span>''</span>, <span>0</span>, <span>1</span>);
wp_usermeta : 用于保存用户元信息(meta)的表。
umeta_id – 元信息ID,bigint(20)值,附加属性auto_increment。
user_id – 元信息对应的用户ID,bigint(20)值,相当于wp_users.ID。
meta_key – 元信息关键字,varchar(255)值。
meta_value – 元信息的详细值,longtext值。
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_usermeta` ( `umeta_id` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `</span><span>user_id</span>` <span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `meta_key` </span><span>varchar</span>(<span>255</span>) <span>DEFAULT</span> <span>NULL</span><span>, `meta_value` longtext, </span><span>PRIMARY</span> <span>KEY</span><span> (`umeta_id`), </span><span>KEY</span> `<span>user_id</span>` (`<span>user_id</span><span>`), </span><span>KEY</span> `meta_key` (`meta_key`(<span>191</span><span>)) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>20</span> ;
<span>INSERT</span> <span>INTO</span> `wp_usermeta` (`umeta_id`, `<span>user_id</span>`, `meta_key`, `meta_value`) <span>VALUES</span><span> (</span><span>1</span>, <span>1</span>, <span>'</span><span>nickname</span><span>'</span>, <span>'</span><span>souvc</span><span>'</span><span>), (</span><span>2</span>, <span>1</span>, <span>'</span><span>first_name</span><span>'</span>, <span>''</span><span>), (</span><span>3</span>, <span>1</span>, <span>'</span><span>last_name</span><span>'</span>, <span>''</span><span>), (</span><span>4</span>, <span>1</span>, <span>'</span><span>description</span><span>'</span>, <span>''</span><span>), (</span><span>5</span>, <span>1</span>, <span>'</span><span>rich_editing</span><span>'</span>, <span>'</span><span>true</span><span>'</span><span>), (</span><span>6</span>, <span>1</span>, <span>'</span><span>comment_shortcuts</span><span>'</span>, <span>'</span><span>false</span><span>'</span><span>), (</span><span>7</span>, <span>1</span>, <span>'</span><span>admin_color</span><span>'</span>, <span>'</span><span>fresh</span><span>'</span><span>), (</span><span>8</span>, <span>1</span>, <span>'</span><span>use_ssl</span><span>'</span>, <span>'</span><span>0</span><span>'</span><span>), (</span><span>9</span>, <span>1</span>, <span>'</span><span>show_admin_bar_front</span><span>'</span>, <span>'</span><span>true</span><span>'</span><span>), (</span><span>10</span>, <span>1</span>, <span>'</span><span>wp_capabilities</span><span>'</span>, <span>'</span><span>a:1:{s:13:"administrator";b:1;}</span><span>'</span><span>), (</span><span>11</span>, <span>1</span>, <span>'</span><span>wp_user_level</span><span>'</span>, <span>'</span><span>10</span><span>'</span><span>), (</span><span>12</span>, <span>1</span>, <span>'</span><span>dismissed_wp_pointers</span><span>'</span>, <span>''</span><span>), (</span><span>13</span>, <span>1</span>, <span>'</span><span>show_welcome_panel</span><span>'</span>, <span>'</span><span>1</span><span>'</span><span>), (</span><span>14</span>, <span>1</span>, <span>'</span><span>session_tokens</span><span>'</span>, <span>'</span><span>a:2:{s:64:"863288c6d33f046c578de0cafee38ec3b49a0ca4e078088b0065cbafcdd06d3c";a:4:{s:10:"expiration";i:1459817885;s:2:"ip";s:3:"::1";s:2:"ua";s:72:"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0";s:5:"login";i:1459645085;}s:64:"310725109de88bde9eb342337323927d2af5e6c98b5662f715dd1acc1697609f";a:4:{s:10:"expiration";i:1459830580;s:2:"ip";s:3:"::1";s:2:"ua";s:72:"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Firefox/45.0";s:5:"login";i:1459657780;}}</span><span>'</span><span>), (</span><span>15</span>, <span>1</span>, <span>'</span><span>wp_dashboard_quick_press_last_post_id</span><span>'</span>, <span>'</span><span>3</span><span>'</span><span>), (</span><span>16</span>, <span>1</span>, <span>'</span><span>managenav-menuscolumnshidden</span><span>'</span>, <span>'</span><span>a:5:{i:0;s:11:"link-target";i:1;s:11:"css-classes";i:2;s:3:"xfn";i:3;s:11:"description";i:4;s:15:"title-attribute";}</span><span>'</span><span>), (</span><span>17</span>, <span>1</span>, <span>'</span><span>metaboxhidden_nav-menus</span><span>'</span>, <span>'</span><span>a:2:{i:0;s:12:"add-post_tag";i:1;s:15:"add-post_format";}</span><span>'</span><span>), (</span><span>18</span>, <span>1</span>, <span>'</span><span>wp_user-settings</span><span>'</span>, <span>'</span><span>mfold=o</span><span>'</span><span>), (</span><span>19</span>, <span>1</span>, <span>'</span><span>wp_user-settings-time</span><span>'</span>, <span>'</span><span>1459658009</span><span>'</span>);
wp_users:用于保存Wordpress使用者的相关信息的表。
ID – 用户唯一ID,bigint(20)值,带附加属性auto_increment。
user_login – 用户的注册名称,varchar(60)值。
user_pass – 用户密码,varchar(64)值,这是经过加密的结果。好象用的是不可逆的MD5算法。
user_nicename – 用户昵称,varchar(50)值。
user_email – 用户电邮地址,varchar(100)值。
user_url – 用户网址,varchar(100)值。
user_registered – 用户注册时间,datetime值。
user_activation_key – 用户激活码,不详。varchar(60)值。
user_status – 用户状态,int(11)值,默认为0。
display_name – 来前台显示出来的用户名字,varchar(250)值。
<span>CREATE</span> <span>TABLE</span> <span>IF</span> <span>NOT</span> <span>EXISTS</span><span> `wp_users` ( `ID` </span><span>bigint</span>(<span>20</span>) unsigned <span>NOT</span> <span>NULL</span><span> AUTO_INCREMENT, `user_login` </span><span>varchar</span>(<span>60</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `user_pass` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `user_nicename` </span><span>varchar</span>(<span>50</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `user_email` </span><span>varchar</span>(<span>100</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `user_url` </span><span>varchar</span>(<span>100</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `user_registered` </span><span>datetime</span> <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0000-00-00 00:00:00</span><span>'</span><span>, `user_activation_key` </span><span>varchar</span>(<span>255</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, `user_status` </span><span>int</span>(<span>11</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>'</span><span>0</span><span>'</span><span>, `display_name` </span><span>varchar</span>(<span>250</span>) <span>NOT</span> <span>NULL</span> <span>DEFAULT</span> <span>''</span><span>, </span><span>PRIMARY</span> <span>KEY</span><span> (`ID`), </span><span>KEY</span><span> `user_login_key` (`user_login`), </span><span>KEY</span><span> `user_nicename` (`user_nicename`) ) ENGINE</span><span>=</span>InnoDB <span>DEFAULT</span> CHARSET<span>=</span>utf8 AUTO_INCREMENT<span>=</span><span>2</span> ;
<span>INSERT</span> <span>INTO</span> `wp_users` (`ID`, `user_login`, `user_pass`, `user_nicename`, `user_email`, `user_url`, `user_registered`, `user_activation_key`, `user_status`, `display_name`) <span>VALUES</span><span> (</span><span>1</span>, <span>'</span><span>souvc</span><span>'</span>, <span>'</span><span>$P$B1X3tpz3DDAzQInF0pTRXff8PxMZ6R0</span><span>'</span>, <span>'</span><span>souvc</span><span>'</span>, <span>'</span><span>291117974@qq.com</span><span>'</span>, <span>''</span>, <span>'</span><span>2016-04-03 00:48:29</span><span>'</span>, <span>''</span>, <span>0</span>, <span>'</span><span>souvc</span><span>'</span>);
参考:
http://blog.csdn.net/liujiyong7/article/details/8042132
http://zmingcx.com/wordpress-database-tdescription.html
http://blog.csdn.net/liujiyong7/article/details/8037843