ress旧域名更换新域名的方法
发布时间:2025-11-04 05:41:37 作者:玩站小弟
我要评论
前言使用WordPress搭建好的域名网站,后来要换新域名了,更换可以通过phpMyAdmin执行SQL语句把旧域名替换成新域名。新域操作步骤一、域名复制以下SQL执行语句,更换粘贴到记事本内。新域UPDATE wp_options SET option_value = REPLACE(option_value,域名 旧域名, 新域名) WHERE option_name = home OR option_name = siteurl; UPDATE wp_posts SET post_content = REPLACE(post_content, 旧域名, 新域名); UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 旧域名,新域名); UPDATE wp_comments SET comment_content = REPLACE(comment_content, 旧域名, 新域名); UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 旧域名,新域名); UPDATE wp_posts SET guid = REPLACE(guid, 旧域名, 新域名) WHERE post_type = attachment; UPDATE wp_options SET option_value = REPLACE(option_value, 旧域名, 新域名) WHERE option_name = home OR option_name = siteurl; UPDATE wp_posts SET post_content = REPLACE (post_content, 旧域名, 新域名); UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 旧域名,新域名); UPDATE wp_comments SET comment_content = REPLACE (comment_content, 旧域名, 新域名); UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 旧域名,新域名); UPDATE wp_posts SET guid = REPLACE (guid, 旧域名, 新域名) WHERE post_type = attachment; UPDATE wp_options SET option_value = REPLACE(option_value, 旧域名, 新域名) WHERE option_name = home OR option_name = siteurl; UPDATE wp_posts SET post_content = REPLACE (post_content, 旧域名, 新域名); UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 旧域名,新域名); UPDATE wp_comments SET comment_content = REPLACE (comment_content, 旧域名, 新域名); UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 旧域名,新域名); UPDATE wp_posts SET guid = REPLACE (guid, 旧域名, 新域名) WHERE post_type = attachment; 二、在记事本中按Ctrl + H键,更换替换旧域名和新域名。新域如果你在安装WordPress时,域名把默认数据表前缀“wp”修改了,更换也要在记事本中替换一下,新域例如我在安装WordPress时,域名数据库前缀修改成bufan,更换记事本替换内容分别填写wp_和bufan_。新域三、打开数据库管理工具,例如phpMyAdmin,如下图点击“SQL”。四、按照下图操作。五、修改数据库的结果。内容看完了 © 版权声明 1:本网站名称:蜡笔傻新2:本站永久网址:https://labishaxin.com/3:本站部分内容收集于互联网,如果有侵权内容、请联系我们删除,不妥之处,敬请谅解4:本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责5:本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报6:本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。

前言
使用WordPress搭建好的域名网站 ,后来要换新域名了 ,更换可以通过phpMyAdmin执行SQL语句把旧域名替换成新域名 。新域
操作步骤
一 、域名复制以下SQL执行语句 ,更换粘贴到记事本内 。新域
UPDATE wp_options SET option_value = REPLACE(option_value,域名 旧域名, 新域名) WHERE option_name = home OR option_name = siteurl; UPDATE wp_posts SET post_content = REPLACE(post_content, 旧域名, 新域名); UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 旧域名,新域名); UPDATE wp_comments SET comment_content = REPLACE(comment_content, 旧域名, 新域名); UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 旧域名,新域名); UPDATE wp_posts SET guid = REPLACE(guid, 旧域名, 新域名) WHERE post_type = attachment; UPDATE wp_options SET option_value = REPLACE(option_value, 旧域名, 新域名) WHERE option_name = home OR option_name = siteurl; UPDATE wp_posts SET post_content = REPLACE (post_content, 旧域名, 新域名); UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 旧域名,新域名); UPDATE wp_comments SET comment_content = REPLACE (comment_content, 旧域名, 新域名); UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 旧域名,新域名); UPDATE wp_posts SET guid = REPLACE (guid, 旧域名, 新域名) WHERE post_type = attachment; UPDATE wp_options SET option_value = REPLACE(option_value, 旧域名, 新域名) WHERE option_name = home OR option_name = siteurl; UPDATE wp_posts SET post_content = REPLACE (post_content, 旧域名, 新域名); UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 旧域名,新域名); UPDATE wp_comments SET comment_content = REPLACE (comment_content, 旧域名, 新域名); UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 旧域名,新域名); UPDATE wp_posts SET guid = REPLACE (guid, 旧域名, 新域名) WHERE post_type = attachment;二、在记事本中按Ctrl + H键,更换替换旧域名和新域名 。新域
如果你在安装WordPress时,域名把默认数据表前缀“wp”修改了,更换也要在记事本中替换一下 ,新域例如我在安装WordPress时,域名数据库前缀修改成bufan,更换记事本替换内容分别填写wp_和bufan_。新域

三
