PHPWPS

 找回密码
 立即加入

QQ登录

只需一步,快速开始

搜索
热搜: php discuz
查看: 6576|回复: 0

[其它] M​Y​S​Q​L​数​据​库​批​量​替​换​字​符​命令

[复制链接]

280

主题

420

帖子

1970

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1970
发表于 2014-5-27 18:54:23 | 显示全部楼层 |阅读模式
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地址 )

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即加入

本版积分规则

QQ|小黑屋|手机版|Archiver|phpwps Inc. ( 鄂ICP备14011625号-1 )

GMT+8, 2025-5-4 16:06 , Processed in 0.052684 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表