en.7v.hk
SevenVee 欢迎来到我的世界

Detailed Explanation of Commands for Batch Modifying Content in MySQL Database

⚠️ 本文最后更新于黄帝4721年六月十五日,已经过了846天没有更新,若内容或图片失效,请留言反馈

General SQL commands can be used to batch modify the contents of a tmysql database, including but not limited to text, domain names, links, and other content, as shown below:

UPDATE `typecho_fields` SET `str_value` = REPLACE(`str_value`,'原来的文本内容','新的文本内容')

As you can see, typecho_fields is one of the data tables in mysql, and str_value is the name of one of the columns under the data table typecho_fields.
It is worth noting that for the original text content and the new text content, if what is entered is ordinary text, there is still a chance to correct mistakes, but if what is entered is a link, it needs to be handled with caution.
If it can include https:// or http://, by no means should you deliberately omit the http protocol header just for temporary convenience and fill in only the domain name part, because in the database, links with the same domain name may very likely have two different protocol headers, https and http.
For example, if what you enter is this:

UPDATE `typecho_fields` SET `str_value` = REPLACE(`str_value`,'archive.huar.net','https://j9.gs')

while in the original database, the replaced links include both https and http, then at this moment the contents of the database will become

    https://https://j9.gs,以及http://https://j9.gs

a situation like this
If so, then the content of the entire website will also become a mess because of the changes to the database, and the loss to yourself is immeasurable. This is especially something webmasters running archive-type websites should pay attention to.
The same applies when using a CDN

UPDATE `typecho_fields` SET `str_value` = REPLACE(`str_value`,'https://archive.huar.net/usr/uploads','https://download.j9.gs/d/cd1/CDN/archive/uploads')

As you can see, here I changed the path location of the uploads folder, and this also means that the paths of other folders and files under the uploads folder remain unchanged; what changes is only the path of the parent folder of that folder.

By 祭酒 On

首次评论需要邮箱验证:填真实邮箱 → 点「获取验证码」→ 输入邮件里的 6 位数字。验证一次后 30 天内免验。

  1. 头像
    @
    La question de l'autocontrôle demeure superficiellement traité dans les contenus standard.
    Votre angle nuance un peu ce paysage étriqué.
    · MacOS · Safari