|
MySQL批量替换指定字段字符串语句:
UPDATE 数据表名 SET 字段名 = replace(字段名, '要替换字符串', '替换为字符串') WHERE 设定条件;
例子1: UPDATE `typecho_contents` SET `text` = replace( `text` , 'girl10000', 'gzhost') WHERE `text` LIKE '%girl10000%';
1、Discuz数据库: UPDATE pre_forum_post SET message=REPLACE(message,'治疗','改善') where message like '%治疗%';
2、Shopex数据库文章:
UPDATE sdb_articles SET content=REPLACE(content,'疗效','效果') where content like '%疗效%';
UPDATE sdb_articles SET title=REPLACE(title,'疗效','效果') where title like '%疗效%';
Shopex数据库商品:
UPDATE sdb_goods SET brand=REPLACE(brand,'疗效','效果') where brand like '%疗效%'; UPDATE sdb_goods SET intro=REPLACE(intro,'疗效','效果') where intro like '%疗效%'; UPDATE sdb_goods SET brief=REPLACE(brief,'疗效','效果') where brief like '%疗效%'; UPDATE sdb_goods SET name=REPLACE(name,'疗效','效果') where name like '%疗效%';
例子2:update wp_posts set post_content=replace(post_content,’qizejixie.com’,’thpinghengqi.com’); WordPress数据库里面几个重点替换的表和字段:
表wp_posts里面的post_content (文章内容) 表wp_posts里面的pinged (ping内容)
表wp_posts里面的guid (WordPress默认链接结构)
表wp_comments里面的comment_author_url (留言作者URL地址 )
|
|