Home > Database > Mysql Tutorial > excel导入到Mysql和mysql数据导出到excel_MySQL

excel导入到Mysql和mysql数据导出到excel_MySQL

WBOY
Release: 2016-06-01 13:39:03
Original
850 people have browsed it

bitsCN.com


excel导入到Mysql和mysql数据导出到excel

 

经过了那么长时间的实践,貌似找到了最简单的一种方法:

 

1.mysql导出到excel:

1.1.SELECT * INTO OUTFILE '/test.xls' FROM table1;

 

2.excel导入到mysql:    

 

 2.1.将选中的数据块儿拷贝到一个TXT文本文件中,假如存到“D:/data.txt”这个位置里。

 

 2.2.根据要导入的数据建立MySql数据库和表,结构和excel结构保持一致.然后进入命令
提示符里使用命令load data local infile 'D:/data.txt' into table tablename fields terminated by '/t';

 

 2.3.将最后一列的回车符号去掉: UPDATE tablename SET  lastcolumnname=
REPLACE(lastcolumnname,'/r','');
 

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