简体   繁体   English

替换MySQL数据库所有表上的文本

[英]Replace text on all tables of MySQL Database

For a single table, following SQL query works fine to replace text: 对于单个表,以下SQL查询可以很好地替换文本:

UPDATE `TABLE_NAME` SET `COLUMN_NAME` = replace(COLUMN_NAME, 'Old_Text', 'New_Text')

I want to replace the keyword 'August' from the whole database to 'September'. 我想将整个数据库中的关键字“ August”替换为“ September”。 Is there anything except manual find/replace on the dump for replacing the text from whole database? 除了在dump上手动查找/替换以替换整个数据库中的文本之外,是否还有其他内容? The dump would be of no help as database size is very huge. 由于数据库很大,因此dump没有任何帮助。

如果您使用的是Linux / Unix,并且确定没有任何命名为August的字段/表,则可以使用sed将9月的每个文本替换为September:

sed -i 's/August/September/g' mydumpfile.sql

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM