MySQL 替换 text 字段中的指定字符串

发布时间: 2018-01-06 08:40:26 作者: 大象笔记

昨天将博客启用了 HTTPS,发现一个包含 js 的 markdown 文章显示异常。

vuejs 中如何优雅的获取 Input 值

导致异常的原因是,https 页面引用了 http 的 js 文件,即 vuejs 的 cdn 链接使用了 http 的。

解决方法就是直接在 mysql 中进行替换

UPDATE articles SET content = REPLACE(content, "http", "https") where slug = 'how-to-get-input-value-in-vuejs'; 

如果需要批量替换数据表中的 http 为 https

UPDATE articles SET content  = REPLACE(content, 'http:', 'https:') WHERE INSTR(content, 'http:') > 0;

INSTR

Returns the position of the first occurrence of substring substr in string str.

我是一名山东烟台的开发者,联系作者