wordpress安装完毕后,域名信息会存到数据库中,即使你给它添加了新的域名,它的链接也还是首次安装后的域名,但我们也许需要更换域名。
1. 使用wordpress插件
不推荐, 插件很可能出错, 到时候就麻烦大了.
2.修改数据库表的信息,来达到同样的效果。下面详细介绍修改数据库的方法。
实测5.5.1只需要更改这四列即可。
update wp_options set option_value=replace(option_value,'旧协议+域名','新协议+域名');
update wp_postmeta set meta_value=replace(meta_value,'旧协议+域名','新协议+域名');
update wp_posts set guid = replace(guid,'旧协议+域名','新协议+域名');
update wp_posts set post_content = replace(post_content,'旧协议+域名','新协议+域名');
如果wordpress有评论,wp_comments表下的comment_author_url应该也更新。别的地方有url,也应该更新,但正常只需要修改上面提到的几个位置
3.wordpress数据库设计,了解一下即可(5.5.1版本)
第一张表:存储评论的元数据wp_commentmeta:
| meta_id | 自增唯一ID | 
| comment_id | 对应评论ID | 
| meta_key | 键名 | 
| meta_value | 键值 | 
 第二张表:存储评论wp_comments
| comment_ID | 自增唯一ID | 
| comment_post_ID | 对应文章ID | 
| comment_author | 评论者 | 
| comment_author_email | 评论者邮箱 | 
| comment_author_url | 评论者网址 | 
| comment_date | 评论时间 | 
| comment_date_gmt | 评论时间(GMT+0时间) | 
| comment_content | 评论正文 | 
| comment_karma | 未知 | 
| comment_approved | 评论是否被批准 | 
| comment_agent | 评论者的USER_AGENT | 
| comment_type | 评论类型(PingBack/普通) | 
| comment_parent | 父评论ID | 
| user_id | 评论者用户ID | 
第三张表:存储友情链接wp_links
| link_id | 自增唯一ID | 
| link_url | 链接URL | 
| link_name | 链接标题 | 
| link_image | 链接图片 | 
| link_target | 链接打开方式 | 
| link_description | 链接描述 | 
| link_visible | 是否可见(Y/N) | 
| link_owner | 添加者用户ID | 
| link_rating | 评分等级 | 
| link_updated | 未知 | 
| link_rel | XFN关系 | 
| link_notes | XFN注释 | 
| link_rss |  | 
第四张表:存储wordpress系统选项和插件、主题配置wp_options
| option_id | 自增唯一ID | 
| blog_id | 博客ID,用于多用户博客,默认为0 | 
| option_name | 键名 | 
| option_value | 键值 | 
| authload | 在WordPress载入时自动载入(yes/no) | 
第五张表:存储文章(包括页面、上传文件、修订)的元数据wp_postmeta
| meta_id | 自增唯一ID | 
| post_id | 对应文章ID | 
| meta_key | 键名 | 
| meta_value | 键值 | 
第六张表:存储文章(包括页面、上传文件、修订)wp_posts
| ID | 自增唯一ID | 
| post_author | 对应v作者ID | 
| post_date | 发布时间 | 
| post_date_gmt | 发布时间(GMT+0时间) | 
| post_content | 正文 | 
| post_title | 标题 | 
| post_excerpt | 摘录 | 
| post_status | 文章状态(publish/auto-draft/inherit) | 
| post_password | 文章密码 | 
| post_name | 文章缩略名 | 
| to_ping | ping的链接 | 
| pinged | 已经PING过的链接 | 
| post_modified | 修改时间 | 
| post_modified_gmt | 修改时间(GMT+0时间) | 
| post_content_filtered | 未知 | 
| post_parent | 父文章,主要用于page | 
| guid | 未知 | 
| menu_order | 排序ID | 
| post_type | 文章类型(post/page等) | 
| post_mime_type | MIME类型 | 
| comment_count | 评论总数 | 
第七张表:存储每个文章、链接和对应分类的关系wp_term_relationships
| object_id | 对应文章ID/链接ID | 
| term_taxonomy_id | 对应分类方法ID | 
| term_order | 排序 | 
第八张表:存储每个目录、标签所对应的分类wp_term_taxonomy
| term_taxonomy_id | wp_term_taxonomy表ID | 
| term_id | 对应wp_terms表中的ID | 
| taxonomy | 表示分类系统(category/post_tag) | 
| description | 分类描述 | 
| parent | 父分类ID | 
| count | 分类文章总数 | 
第九张表:存储网站分类和标签的属性wp_termmeta
| meta_id | wp_termmeta表ID | 
| term_id | 对应wp_terms表中的ID | 
| meta_key | 属性键名 | 
| meta_value | 属性键值 | 
第十张表:存储每个目录、标签wp_terms
| term_id | 分类ID | 
| name | 分类名 | 
| slug | 缩略名 | 
| term_group | 未知 | 
第十一张表:存储用户的元数据wp_usermeta
| umeta_id | 自增唯一ID | 
| user_id | 对应用户ID | 
| meta_key | 键名 | 
| meta_value | 键值 | 
第十二张表:存储用户wp_users
| ID | 自增唯一ID | 
| 键值 | 登录名 | 
| user_pass | 密码 | 
| user_nickname | 昵称 | 
| user_email | 邮箱 | 
| user_url | 网址 | 
| user_registered | 注册时间 | 
| user_status | 用户状态 | 
| display_name | 显示名称 | 
本篇完,还有疑问?
加入QQ交流群:11500065636 