- 操作前设置:
- 找到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']
本文档介绍了如何修改MySQL的配置文件以允许数据导入导出,并提供了导入导出语句的示例。重点在于调整secure-file-priv设置为允许数据传输,以及避免在C盘进行操作以防止错误。同时,还给出了桌面文件夹移动到D盘的方法,以确保文件路径合规。在导入数据时使用`LOAD DATA INFILE`语句,导出则使用`SELECT ... INTO OUTFILE`语句。

615

被折叠的 条评论
为什么被折叠?



