{"id":4713,"date":"2024-03-20T15:47:44","date_gmt":"2024-03-20T07:47:44","guid":{"rendered":"http:\/\/101.37.83.176\/?p=4713"},"modified":"2024-03-20T15:47:44","modified_gmt":"2024-03-20T07:47:44","slug":"wordpress-mysql-replace","status":"publish","type":"post","link":"http:\/\/101.37.83.176\/?p=4713","title":{"rendered":"\u67e5\u627e\u5e76\u66ff\u6362WordPress\u7684Mysql\u6570\u636e\u5e93\u4e2d\u7684\u57df\u540d"},"content":{"rendered":"<p>\u65e0\u8bba\u662f\u66f4\u6362\u57df\u540d\uff0c\u8fd8\u662f\u4ece http:\/\/ \u66f4\u6539\u4e3a https :\/\/\uff0c\u6211\u4eec\u90fd\u53ef\u4ee5\u4f7f\u7528 MySQL \u7684 replace\u529f\u80fd\uff0c\u6765\u66ff\u6362\u6570\u636e\u5e93\u4e2d\u7684 \u5b57\u6bb5\u3002<br \/>\n\u5982\u679c\u8981\u5c06 WordPress \u7f51\u7ad9\u8fc1\u79fb\u5230\u4e0d\u540c\u7684\u57df\u540d\uff0c\u4f7f\u7528PHPMYADMIN\u8fdb\u5165\u6570\u636e\u5e93\u7ba1\u7406\u3002\u70b9\u51fbSQL\uff0c\u6267\u884cSQL\u8bed\u53e5:<br \/>\nUPDATE\u2018\u8868\u540d\u2019SET\u2018\u5b57\u6bb5\u2019=REPLACE(\u2019\u5b57\u6bb5\u2019,\u2019\u5f85\u66ff\u6362\u5185\u5bb9\u2019,\u2019\u66ff\u6362\u503c\u2019);<\/p>\n<p>\u4f8b\u5982\uff0c\u4ece\u57df\u540dold_domain.com\u8fc1\u79fb\u5230\u57df\u540dnew_domain.com\u3002\u6216\u8005\u5c06\u6570\u636e\u5e93\u4e2d\u6240\u6709http:\/\/old_domain.com\u66ff\u6362\u4e3ahttps:\/\/old_domain.com\uff0c\u53ef\u4ee5\u6267\u884c\u4e0b\u9762\u7684 SQL \u8bed\u53e5\uff1a<\/p>\n<p>wp_options \u8868<br \/>\nwp_options \u8868\u662f WordPress \u914d\u7f6e\u8868\uff0c\u5728home\u548csiteurl\u5b57\u6bb5\u4e2d\uff0c\u53ef\u4ee5\u914d\u7f6e\u7f51\u7ad9\u7684 URL \u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">UPDATE wp_options SET option_value = replace(option_value, &#039;old_domain.com&#039;, &#039;new_domain.com&#039;) WHERE option_name = &#039;home&#039; OR option_name = &#039;siteurl&#039;;<\/pre>\n<p>wp_posts \u8868<br \/>\nwp_posts\u8868\u7684post_content\u5b57\u6bb5\u4e2d\u7684\u5305\u542b\u6240\u6709\u6587\u7ae0\u5185\u5bb9\u3002\u5982\u679c\u6587\u7ae0\u4e2d\u6709\u6307\u5411\u5176\u4ed6\u6587\u7ae0\u7684\u5185\u90e8\u6c38\u4e45\u94fe\u63a5\uff0c\u9700\u8981\u66ff\u6362\u8be5\u8868\u4e2d\u7684\u94fe\u63a5 URL\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">UPDATE wp_posts SET post_content = replace(post_content, &#039;old_domain.com&#039;, &#039;new_domain.com&#039;);<\/pre>\n<p>wp_postmeta \u8868<br \/>\nwp_postmeta\u8868\u5305\u542b\u6240\u6709\u7684\u5c5e\u6027\u548c\u81ea\u5b9a\u4e49\u5b57\u6bb5\uff0c\u4f8b\u5982 ACF \uff08\u9ad8\u7ea7\u81ea\u5b9a\u4e49\u5b57\u6bb5\uff09\u4e2d\u7684meta_value\u5b57\u6bb5\u3002\u5982\u679c\u81ea\u5b9a\u4e49\u5b57\u6bb5\u4e2d\u5305\u542b\u65e7\u7684\u94fe\u63a5\uff0c\u4e5f\u9700\u8981\u5728\u6b64\u5904\u66ff\u6362\u5b83\u4eec\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">UPDATE wp_postmeta SET meta_value = replace(meta_value, &#039;old_domain.com&#039;, &#039;new_domain.com&#039;);<\/pre>\n<p>wp_comments \u8868<br \/>\nwp_comments\u8868\u5305\u542b\u6240\u6709\u7684\u6587\u7ae0\u8bc4\u8bba\u5185\u5bb9\uff0c\u5176\u4e2d\u4e5f\u53ef\u80fd\u5305\u542b\u6307\u5411\u5176\u4ed6\u6587\u7ae0\u7684\u65e7\u94fe\u63a5\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">UPDATE wp_comments SET comment_content = replace(comment_content , &#039;old_domain.com&#039;, &#039;new_domain.com&#039;);<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u67e5\u627e\u5e76\u66ff\u6362WordPress\u7684Mysql\u6570\u636e\u5e93\u4e2d\u7684\u57df\u540d<\/p>\n","protected":false},"author":1,"featured_media":4714,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[71],"tags":[329,330,239],"class_list":["post-4713","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-lamp","tag-mysql","tag-phpmyadmin","tag-wordpress"],"_links":{"self":[{"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/posts\/4713","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4713"}],"version-history":[{"count":1,"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/posts\/4713\/revisions"}],"predecessor-version":[{"id":4715,"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/posts\/4713\/revisions\/4715"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=\/wp\/v2\/media\/4714"}],"wp:attachment":[{"href":"http:\/\/101.37.83.176\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4713"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4713"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/101.37.83.176\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4713"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}