MySQL batch replacement of the specified field string SQL statement and instance Analysis _ MySQL

Source: Internet
Author: User
MySQL batch replaces the specified field string SQL statement and instance analysis bitsCN. comMySQL batch replacement is a feature that we often use. sometimes, when the site contains sensitive words, it will cause us trouble. However, when the amount of information is large, it is unrealistic to search and modify an article.
It is easy to use MySQL for batch replacement. Released here for reference.
MySQL batch replace a specified field string statement
UPDATE data table name SET field name = replace (field name, string to be replaced, replace with) WHERE to SET conditions;
For example, the website found that the title of the article about linux commands on the site is not very good today. in the past, we used to explain how to use mkdir commands in linux --- create directory commands in linux
This format is not very useful for searching because few people search for mkdir in details and mkdir in linux, and then search for mkdir commands, mkdir parameters,
Mkdir, usage, and linux mkdir (with spaces instead of a "lower" character in the middle) are widely used. for a comprehensive consideration, the mkdir command parameters and usage are changed to linux. --- create a directory command in linux
Obviously, this kind of keyword containing more is more in line with users' search habits. If you change it, you can change it. However, the current website has issued several hundred commands, and manual modification will be exhausting.
As a result, you can run a few commands on mysql.
UPDATE 'so so _ archives 'set 'title' = replace (title, linux) WHERE 'typeid' = 18;
UPDATE 'so so _ archives 'set 'title' = replace (title, command usage details, command parameters and usage details) WHERE 'typeid' = 18
You can set replacement conditions based on your needs. I hope you can collect this useful item for your convenience. BitsCN.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.