有时候我们在网站搬家、更换域名的时候,很多配置信息是写在MySQL数据库里面的。这时候我们需要将数据库里面的相关配置信息替换成新空间或域名的信息。我们就需要用到MySQL的字符串替换函数Replace了。具体用法如下:
MySQL Replace 替换函数语法:
update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, "find this string", "replace found string with this string");
Replace 替换函数案例:
update client_table set url = replace(url, "shumaquan.com", "eduyo.com")
这样就能将MySQL中所有字符串替换成新的了。
(责任编辑:ken)