概述
手头有一个 10M 的 json 文件需要导入到 MySQL 中,测试了各种方案,发现使用 MySQLWorkbench 的数据导入功能是最方便的。
MySQLWorkbench
MySQLWorkbench 是 MySQL 官方开发的图形化客户端,优点是支持 json 文件导入,缺点都很久都不更新了,有各种小 bug。使用 MySQLWorkbench 导入 json 文件需要创建好目标库表结构,然后在要导入数据的表上点击右键,选择:Table Data Import Wizard:

在接下来的窗口中,选择要导入的 json 文件:

点击 Next,在接下来的窗口中,把 json 文件的字段与 MySQL 表的字段对应好,然后点击 Next:

接下来进入一个等待界面,无法查看导入进度:

可以再打开一个 MySQL 客户端,count 一下表数据量,获取导入进度:

可以看到数据在缓慢增长,感觉这内部实现是没有做批量插入。
导入成功:

已经导入的数据如下所示:

Post a comment now »
本文目前不可评论
Sorry, the comment form is closed at this time.
No comments yet.