一个字段为 config
json DEFAULT NULL COMMENT ‘json配置’
存的值为 {“name”:“模板"T"型”}
更新该字段sql为
update table_1 set config = ‘{“name”:“模板"T"型”}’ where id = xx
更新成功,重新查看该字段,值为
{“name”:“模板"T"型”} 反斜杠\被当做转义符自动替换掉了,需要将\再次转义
mysql自动去除了转义符,需要将更新sql改为
update table_1 set config = ‘{“name”:"模板\"T\“型”}’ where id = xx
mysql一个关于更新json类型字段的坑
于 2023-04-11 16:21:16 首次发布