1. 导入前设置
-
首先找到MySQL 数据库默认文件目录(例如:‘C:\ProgramData\MySQL\MySQL Server 8.0’)。如下图,我们建立的database都在*'Data’文件夹中,后续导出的文件默认也会在该这个文件夹的子文件夹里(相对应的database子文件夹);‘Uploads’*文件夹是默认的导入文件夹。
-
默认文件夹使用起来往往不方便,修改默认文件夹过程中又会遇到各种ERROR。所以这里建议直接建一个默认文件夹的快捷方式。
2. 导入导出语句
- 导入语句
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']
具体可参考
https://blog.csdn.net/alen_liu_sz/article/details/79552089?ops_request_misc=&request_id=&biz_id=102&utm_term=mySQL%20%E5%AF%BC%E5%87%BA&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-3-79552089.nonecase&spm=1018.2226.3001.4187