UPDATE wp_options SET option_value = REPLACE(option_value, 'https://old.yuucn.com', 'https://new.yuucn.com') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET post_content = REPLACE (post_content, 'https://old.yuucn.com', 'https://new.yuucn.com'); UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'https://old.yuucn.com','https://new.yuucn.com'); UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'https://old.yuucn.com', 'https://new.yuucn.com'); UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'https://old.yuucn.com','https://new.yuucn.com'); UPDATE wp_posts SET guid = REPLACE (guid, 'https://old.yuucn.com', 'https://new.yuucn.com') WHERE post_type = 'attachment';
wordpress 域名更换
old是旧域名
new是新域名
wp_是数据库前缀
请使用批量替换工具替换,例如记事本,然后运行上面的SQL,执行即可,出错表示你命令用错了