科技美学

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1.0 database connection

define( 'DB_NAME', 'db_table' );
define( 'DB_USER', 'db_name' );
define( 'DB_PASSWORD', 'db_password' );
define( 'DB_HOST', 'db_host' );

  go to {root}/wp-config.php

 

2.0 change wordpress db table

wp_options -> siteurl = 公众访问的网络位址
wp_options -> home = 公众访问的网络位址

 

3.0 run sql script to update siteurl & home on post content

UPDATE wp_posts SET post_content = REPLACE(post_content, '{old_domain}/wp-content/uploads', '{new_domain}/wp-content/uploads');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, '{old_domain}/wp-content/uploads', '{new_domain}/wp-content/uploads');

  If you save old_domain on wp_postmeta, you will need to update them also.

 

Update 2022-07-05

UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://{old_domain}/', 'http://{new_domain}/');
UPDATE wp_posts SET guid = REPLACE(guid, 'http://{old_domain}/', 'http://{new_domain}/');
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'http://{old_domain}/', 'http://{new_domain}/');

  官方文件有遺漏,正確的update .sql應包含所有domain。

 

posted on 2022-06-10 16:35  chankuang  阅读(62)  评论(0编辑  收藏  举报