Home > Database > Mysql Tutorial > mysql使用SQLyog导入csv数据不成功的解决方法_MySQL

mysql使用SQLyog导入csv数据不成功的解决方法_MySQL

WBOY
Release: 2016-06-01 13:05:24
Original
1177 people have browsed it

今天给mysql导入数据,使用的软件是SQLyog,相信直接导大家也都会,选中某个表选择导入--导入使用本地csv数据即可,单有的时候不知道什么问题导入不成功,可以使用命令,以此记录,以后用到便于查:

(我的是windows系统)

LOAD DATA LOCAL INFILE 'C:\\Users\\zl\\Desktop\\zhishu.csv'
INTO TABLE 库名.表名 CHARACTER SET gbk 
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' ESCAPED BY '"' 
LINES TERMINATED BY '\r\n'(
id, 
`name`,
`description`,
parent_id
)
Copy after login

注意:

1.csv内文件一般是中文的gbk编码,所以此处设置编码为gbk
2. 括号内是字段名

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