Home > Database > Mysql Tutorial > 把本地的*.txt数据导入数据库_MySQL

把本地的*.txt数据导入数据库_MySQL

WBOY
Release: 2016-06-01 13:35:54
Original
1524 people have browsed it

bitsCN.com

把本地的*.txt数据导入数据库

 

第一步:D盘里的txt文件如下:

路径为:d:/data/mysql.txt 

 

把本地的*.txt数据导入数据库_MySQL 

第二步:创建表: 

 

Java代码 

create table msg( 

id int, 

name varchar(20), 

sex varchar(10), 

age1 int, 

age2 int 

 

 

把本地的*.txt数据导入数据库_MySQL 

第三步:把数据导入数据库 

Java代码 

load data local infile "d:/data/mysql.txt" into table msg; 


把本地的*.txt数据导入数据库_MySQL 

注意:mysql.txt文件的格式,每一列的数据中间需点击下Tab键隔开。 
bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template