Batch Replace Character Content in MySQL Database **WordPress** 提供了一个功能强大的工具来批量替换 MySQL 数据库中的字符内容。下面是一个使用 **WooCommerce** 和 **Slider Revolution** 插件的示例: ```sql UPDATE wp_posts SET post_content = REPLACE(post_content, '旧字符', '新字符') WHERE post_type = 'post' OR post_type = 'page'; ``` 这个查询将在 `wp_posts` 表中找到所有的文章和页面,然后将 `post_content` 列中的所有 `旧字符` 替换为 `新字符`。 如果你想在 `wp_options` 表中替换字符,可以使用以下查询: ```sql UPDATE wp_options SET option_value = REPLACE(option_value, '旧字符', '新字符') WHERE option_name = 'option_name'; ``` 这个查询将在 `wp_options` 表中找到指定的选项,然后将 `option_value` 列中的所有 `旧字符` 替换为 `新字符`。 **Quickstyle** 提供了一个更复杂的批量替换工具,可以在多个表中替换字符。下面是一个使用 **Press brake machine** 和 **CNC press brake** 的示例: ```sql UPDATE wp_posts, wp_options SET wp_posts.post_content = REPLACE(wp_posts.post_content, '旧字符', '新字符'), wp_options.option_value = REPLACE(wp_options.option_value, '旧字符', '新字符') WHERE wp_posts.post_type = 'post' OR wp_posts.post_type = 'page' OR wp_options.option_name = 'option_name'; ``` 这个查询将在 `wp_posts` 和 `wp_options` 表中找到所有的文章、页面和选项,然后将 `post_content` 和 `option_value` 列中的所有 `旧字符` 替换为 `新字符`。 **Fiber laser cutting machine** 提供了一个高级的批量替换工具,可以在多个表中替换字符,并且可以使用正则表达式。下面是一个使用 **Hydraulic press brake** 的示例: ```sql UPDATE wp_posts, wp_options SET wp_posts.post_content = REGEXP_REPLACE(wp_posts.post_content, '旧字符', '新字符'), wp_options.option_value = REGEXP_REPLACE(wp_options.option_value, '旧字符', '新字符') WHERE wp_posts.post_type = 'post' OR wp_posts.post_type = 'page' OR wp_options.option_name = 'option_name'; ``` 这个查询将在 `wp_posts` 和 `wp_options` 表中找到所有的文章、页面和选项,然后将 `post_content` 和 `option_value` 列中的所有 `旧字符` 替换为 `新字符` 使用正则表达式。 请注意,这些查询只是示例,需要根据你的实际情况进行修改。

 6 years ago     1.5K  

Article directory

When we are processing in bulk MySQL DatabaseWhen the time comes, you will often encounter situations where you need to batch replace some specific character content across multiple forms. When you encounter such situations, you cannot perform a search and replace operation one by one. This is when you need to use the batch replace character content MySQL command to perform the replacement operation. (Note: No translation was performed on the following terms: MySQL, batch replace, character content)

For example, when we encounter the following situation in our database:

Name: area
id name
1 Yu Zhou
2 Yu County
3 Yu County
4 Yu County
5 Yu Zhou

We want to translate the name field in“Yu Zhou Shi” 统一改为“Yu Zhou”You need to use the following command:

update `area` set `name` = replace(name, '市', '');

Alternatively, you can also use:

update `area` set `name` = replace(name, '禹州市', '禹州');

Actually, these two methods use the same command, just with a slightly different replacement method! Everyone in网站Data migration replacing domain name, orWebsite deployment SSL certificateAfter modifying the HTTPS domain prefix, you may need to use this command to perform batch replacement of database content.

Copyright Notice:铭创网络 Published on 6 years ago,common 391 word。
Please indicate:Batch Replace Character Content in MySQL Database **WordPress** 提供了一个功能强大的工具来批量替换 MySQL 数据库中的字符内容。下面是一个使用 **WooCommerce** 和 **Slider Revolution** 插件的示例: ```sql UPDATE wp_posts SET post_content = REPLACE(post_content, '旧字符', '新字符') WHERE post_type = 'post' OR post_type = 'page'; ``` 这个查询将在 `wp_posts` 表中找到所有的文章和页面,然后将 `post_content` 列中的所有 `旧字符` 替换为 `新字符`。 如果你想在 `wp_options` 表中替换字符,可以使用以下查询: ```sql UPDATE wp_options SET option_value = REPLACE(option_value, '旧字符', '新字符') WHERE option_name = 'option_name'; ``` 这个查询将在 `wp_options` 表中找到指定的选项,然后将 `option_value` 列中的所有 `旧字符` 替换为 `新字符`。 **Quickstyle** 提供了一个更复杂的批量替换工具,可以在多个表中替换字符。下面是一个使用 **Press brake machine** 和 **CNC press brake** 的示例: ```sql UPDATE wp_posts, wp_options SET wp_posts.post_content = REPLACE(wp_posts.post_content, '旧字符', '新字符'), wp_options.option_value = REPLACE(wp_options.option_value, '旧字符', '新字符') WHERE wp_posts.post_type = 'post' OR wp_posts.post_type = 'page' OR wp_options.option_name = 'option_name'; ``` 这个查询将在 `wp_posts` 和 `wp_options` 表中找到所有的文章、页面和选项,然后将 `post_content` 和 `option_value` 列中的所有 `旧字符` 替换为 `新字符`。 **Fiber laser cutting machine** 提供了一个高级的批量替换工具,可以在多个表中替换字符,并且可以使用正则表达式。下面是一个使用 **Hydraulic press brake** 的示例: ```sql UPDATE wp_posts, wp_options SET wp_posts.post_content = REGEXP_REPLACE(wp_posts.post_content, '旧字符', '新字符'), wp_options.option_value = REGEXP_REPLACE(wp_options.option_value, '旧字符', '新字符') WHERE wp_posts.post_type = 'post' OR wp_posts.post_type = 'page' OR wp_options.option_name = 'option_name'; ``` 这个查询将在 `wp_posts` 和 `wp_options` 表中找到所有的文章、页面和选项,然后将 `post_content` 和 `option_value` 列中的所有 `旧字符` 替换为 `新字符` 使用正则表达式。 请注意,这些查询只是示例,需要根据你的实际情况进行修改。 | 赢聚网

You may be interested

No comments

No comments...