替换 MySQL 数据库所有表上的文本 [英] Replace text on all tables of MySQL Database
本文介绍了替换 MySQL 数据库所有表上的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对于单个表,以下 SQL 查询可以很好地替换文本:
For a single table, following SQL query works fine to replace text:
UPDATE `TABLE_NAME` SET `COLUMN_NAME` = replace(COLUMN_NAME, 'Old_Text', 'New_Text')
我想将整个数据库中的关键字August"替换为September".除了在 dump
上手动查找/替换之外,还有什么可以替换整个数据库中的文本吗?dump
没有任何帮助,因为数据库非常庞大.
I want to replace the keyword 'August' from the whole database to 'September'. Is there anything except manual find/replace on the dump
for replacing the text from whole database? The dump
would be of no help as database size is very huge.
推荐答案
如果你使用的是 Linux/Unix 并且确定你没有任何命名为 August 的字段/表,你可以使用 sed
用九月替换八月的每个文本:
If you are using Linux/Unix and are sure you don't have any fields/tables namned August, you could use sed
to replace every text August with September:
sed -i 's/August/September/g' mydumpfile.sql
这篇关于替换 MySQL 数据库所有表上的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文