我正在尝试在MySQL的Json列中保存带有反斜杠的字符串
CREATE TABLE `config`.`test` (
`test` JSON NULL);
insert into `config`.`test` values ('{ "host": "dldbecom01-p\sql"}')
当我选择数据时,反斜杠就会消失
{"host": "dldbecom01-psql"}
我知道反斜杠是转义字符。我试图将其倍增为:
insert into `config`.`test` values ('{ "host": "dldbecom01-p\\sql"}')
但是我得到这个错误:
Error Code: 3140. Invalid JSON text: "Invalid escape character in string." at position 24 in value for column 'test.test'.
如何将该字符串存储在json中?
dldbecom01-p\sql