首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >将CSV导入phpmyadmin

将CSV导入phpmyadmin
EN

Stack Overflow用户
提问于 2012-03-16 17:12:18
回答 2查看 138.7K关注 0票数 29

我有一个CSV,看起来像这样

代码语言:javascript
复制
candidate_id,show_on_site,first_name,surname,gender,DOB,showdob,Location,height,eyes,hair_colour,hair_length,accents,unions,training,url,visible,availability
,26,urban talent,Strawberry,Shortcake,Female,11 Jan 1942,FALSE,Manchester,5'2,Brown,Black,Mid-length,Native Lancashire,Equity,Urban Talent TV & Drama Workshops,Strawberry-Shortcake---5.4.06.jpg,Yes,Yes
,29,urban talent,Rainbow,Brite,Female,12 Oct 1970,FALSE,Manchester,5'7,Brown,Dark Brown,Long,"Native Manchester, others include - Cheshire, RP, Patois, Standard USA",Equity Member,"BA Acting Studies, Arden School of Theatre<br>Urban Talent TV & Drama Workshops",Rainbow Brite 1_1.jpg,Yes,Yes
,31,urban talent,Webbigail,Vanderquack,Female,4 Jun 1947,FALSE,Manchester,5'0,Hazel,Blonde,Mid-length,"Native Manchester, others include - Liverpool, Cockney, Birmingham, West Country, Standard Scottish, Standard Welch, S Irish",,Manchester School of Acting<br>3 Years at David Johnson Acting Workshops,Webbigail Vanderquack web 1.jpg,Yes,Yes
,33,urban talent,Smurfette,Smurf,Female,1 Jul 1979,FALSE,Manchester,5'2,Dark Brown,Dark Brown,Long,"Native Manchester, others include - Liverpool, RP, Lancashire, Birmingham, Cockney, Devon, Geordie, West Country, Glasgow, Edinburgh, South African, Standard & Southern US, Persian, Asian, Indian ~ good ear for accents",,"Manchester School of Acting, with Mark Hudson<br>North Cheshire Theatre College, with David Johnson<Oldham Theatre Workshop",Smurfette Smurf web 4.jpg,Yes,Yes

有没有可能只是将这些数据插入到我的数据库中现有的列中,我所能做的就是将它作为一个新的表插入,然后这个表就有了名为A、B、C、D、E等的列。

EN

回答 2

Stack Overflow用户

发布于 2012-03-16 17:42:59

在phpMyAdmin中,单击表,然后单击页面顶部的“导入”选项卡。

浏览并打开csv文件。保持字符集不变。除非您有一个庞大的数据集(或速度较慢的服务器),否则请取消选中部分导入。在选择文件后,格式应该已经选择了“CSV”,如果没有,则选择它(不使用加载数据)。如果您想在导入前清除整个表,请勾选“将表数据替换为文件”。如果您认为CSV文件中有重复项,也可以选中“忽略重复行”。现在是重要的部分,将接下来的四个字段设置为这些值:

代码语言:javascript
复制
Fields terminated by: ,
Fields enclosed by: “
Fields escaped by: \
Lines terminated by: auto

目前,除了缺省为分号的“Fields terminated by”之外,这些字段都与缺省值匹配。

现在单击Go按钮,它应该会成功运行。

票数 44
EN

Stack Overflow用户

发布于 2013-08-12 19:35:35

这是由于id造成的(缺少自动增量字段)。如果您在文本编辑器中通过为ID字段添加逗号对其进行编辑,则此问题将得到解决。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9734486

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档