一、使用load data infile命令

load data[local] infile file_name into table table_name [option];

mysql文本文件导入到数据库_程序员
举例:

load data infile 'c:/t_dept.txt' into table t_dept
fields terminated by '\、'
optionally enclosed by '\"'
terminated by '\r\n';

二、使用mysqlimport命令

mysqlimport -u root -pPassword[--local] dbname file_name[option]

mysql文本文件导入到数据库_mysql文本文件导入到数据库_02

举例:

mysqlimport -u root -proot company c:\t_dept.txt 
"--fields-terminated-by=、"
"--fields-optionally-enclosed-by=""
"--lines-terminated-by=\r\n"