美文网首页
MySQL JSON type Export/Import

MySQL JSON type Export/Import

作者: alston_tsao | 来源:发表于2018-02-21 11:44 被阅读0次

MySQL 5.7之後便支援JSON格式,然而在import/export資料時卻有一些問題,如果export SQL檔案的話,JSON欄位的值會變成binary表示,例如這樣

X'7B22666565223A20302C202264617465223A20'

若import到別的database會出現錯誤:

import cannot create a JSON value from a string with CHARACTER SET 'binary'

解法為:

搜尋 (X'[^,\)]*')
取代 CONVERT($1 using utf8mb4)

===================

另外,若有些欄位是JSON generated,直接export SQL然後import到別的database一樣會出錯,解法是把tabe跟data分開處理,export table成sql,data則用csv輸出。import data時,忽略所有JSON generated fields。

ref: MySQL 5.7.12 import cannot create a JSON value from a string with CHARACTER SET 'binary'

相关文章

  • MySQL JSON type Export/Import

    MySQL 5.7之後便支援JSON格式,然而在import/export資料時卻有一些問題,如果export S...

  • MySQL 5.7 JSON特性支持

    Reference MySQL 5.7 The JSON Data Type Practice Json 类型: ...

  • ES6模块化代码图解

    export(导出) / import(导入) 每个.js文件就是一个一个的模块,script标签绑定type="...

  • 模块化语法

    1. import + export default 2. import + export 3. import +...

  • export,import

    ES6之前模块加载方案,CommonJS (用于服务器)和 AMD(浏览器)2.CommonJS 和 AMD模块只...

  • import export

    import export 这两个家伙对应的就是es6自己的module功能。 我们之前写的Javascript一...

  • import export

    一 import 导入整个模块的内容 用于导入由另一个模块导出的绑定。 在这里,访问导出意味着使用模块名称(在这种...

  • import export

    今天在用import引入公共模块的时候忽然报错了,如图: 我一看,我去,居然少了一个括号,然后匆忙去看我的代码发现...

  • import & export

    在es6中,我们 export的方式有很多但是import的时候也要 用户有时候不想知道你输出的到底有啥,那么可以...

  • export import

    export可以导出引用地址 import export from

网友评论

      本文标题:MySQL JSON type Export/Import

      本文链接:https://www.haomeiwen.com/subject/zdnntftx.html