数据的导入
方法1 :图形工具
方法2: SQL 语句
load data infile 文件路经 into table <table name> fields terminated by ' ' lines terminated by '\r\n'
空格: fields terminated by ' \t'
逗号:fields terminated by ', '
in windown, the file address is ,e.g D:\Study\MySQL, here <file address> should be ' D:/Study/MySQL'
csv format
去掉第一行标题行
load data infile 'D:/stuScore_data.csv'
into table StuScore FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n';
保留第一行标题行
load data infile 'D:/stuScore.csv'
into table StuScore2 fields terminated by ',' enclosed by '"' ignore 1 lines;
text format:
load data infile 'D:/Python/StuInfo_import.txt' into table StuInfo fields terminated by ',' lines terminated by '\r\n';
错误:1290
****错误:1290 - The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
处理方式:修改mysql配置文件my.ini中secure-file-priv的值,为空任意文件目录导出,配置目录为指定目录导入导出。
如何找配置文件my.ini?
win10,直接查找 服务 ->属性