phpMyAdmin中批量替换字段的SQL语句
Published by Xianqiao Wang on April 24th, 2015
UPDATE 数据表名 SET 表内某字段 = REPLACE(表内某字段, ‘原内容’,’新内容’)
比如您以前的博客域名为a.com,现在您博客域名更换为b.com,那么,您可以用
UPDATE wp_posts SET guid = REPLACE (guid, 'a.com' , 'b.com' ) |
快速替换掉wp_posts表内的guid字段,其它表的替换以此类推。
UPDATE wp_posts SET guid = REPLACE(guid, 'mantou.eu.org','www.594mantou.com')
UPDATE wp_posts SET post_content = REPLACE(post_content, 'mantou.eu.org','www.594mantou.com')
UPDATE wp_commentmeta SET meta_value = REPLACE(meta_value, 'mantou.eu.org','www.594mantou.com')
UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, 'mantou.eu.org','www.594mantou.com')
UPDATE wp_options SET option_value = REPLACE(option_value, 'mantou.eu.org','www.594mantou.com')
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, 'mantou.eu.org','www.594mantou.com')