- 操作前设置:
- 找到MySQL数据库默认文件目录,可参考下图
- 用记事本打开my.ini文件,ctrl+F找到secure-file-priv 令其等于空字符,如图。保存(无法保存的要改文件属性)。
- 重启MySQL服务:搜索—>服务—>重启MySQL,即可。
导入导出语句
-
注意事项:文件路径不要在C盘,系统盘。否则会出现各种error。
-
桌面迁到D盘教程:右击桌面 —> 属性—> 位置—>移动即可。方便在桌面导入导出文件。
-
导入语句
load data [low_priority] [local] infile 'file_name txt' [replace | ignore]
into table tbl_name
[fields
[terminated by't']
[OPTIONALLY] enclosed by '']
[escaped by'\' ]]
[lines terminated by'n']
[ignore number lines]
[(col_name,...)]
具体可参考:https://www.iteye.com/blog/hunan-752606
- 导出语句
SELECT * [low_priority] [local] infile 'file_name txt' [replace | ignore]
FROM tbl_name
[fields
[terminated by't']
[OPTIONALLY] enclosed by '']
[escaped by'\' ]]
[lines starting by 'string'
[lines terminated by'string']