使用PHPMyAdmin导入CSV时出现问题

时间:2014-04-09 17:27:24

标签: mysql csv import phpmyadmin

我有一个Excel电子表格,我已将其导出为CSV文件。

我在导入时遇到了很多麻烦。它看起来像是这样的:

Web_Site_Member_ID,Master_Member_ID,API_GUID,Constituent_ID,Registration_Date,Approved_Site_Member,Date_Approved,Date_Last_Login,Member_Suspended,Last_Updated,Date_Membership_Expires,Membership,Has_Donated_Online,Date_Last_Donated,Has_Purchased_Online,Date_Last_Purchased,Has_Registered_Event_Online,Date_Last_Event_Reg,Username,Password,Member_Type_Code,Primary_Group_Code,Gender,First_Name,Middle_Name,Last_Name,Nickname,Member_Name_Suffix,Member_Name_Title,Birthdate,Marriage_Status,Maiden_Name,Anniversary_Date,Spouse_Name,Email_Address,Email_Address_Alternate,Email_Bounced,Messenger_Type,Messenger_Handle,Home_Address_Line1,Home_Address_Line2,Home_City,Home_Location,Home_State_Abbrev,Home_Postal_Code,Home_Country,Personal_Website,Home_Phone_Area_Code,Home_Phone,Mobile_Area_Code,Mobile,Employer_Name,Professional_Title,Profession,Employer_Address_Line1,Employer_Address_Line2,Employer_City,Employer_Location,Employer_State_Abbrev,Employer_Postal_Code,Employer_Country,Employer_Website,Employer_Phone_Area_Code,Employer_Phone,Employer_Fax_Area_Code,Employer_Fax,Resume_Exists,Resume_Headline,Social_Organizations,Education_and_Experience,More_Personal_Info,Search_Identifier,Internal_Comments,Home_Address_Validated,Employer_Address_Validated,Date_Last_Renewed,Date_Effective_Membership_Expires,Import_Batch_ID,Career_Openings_Allowed,Members_Pages_Allowed,Additional_Seats_Allowed

我尝试使用PHPMyAdmin将其导入MySQL。

在每个新行上都是一个条目,它是所有人员数据,但它遵循您期望的格式:

123456678 ,,,1-2-3-4-5-6,123345456,01 / 01/1901 00:00,Yes,01/01/2001 13:09 ,, No,01/01/2001 13: 09 ,,,不,,不,,不,1 @ 1.come,111222333444555,Emeritus_TAD ,,, ...等等

每次我尝试导入它都会出错。如果我说

#1118 - Row size too large. The maximum row size for the used table type,
not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs

起初我以为它没有认识到第一行文字的结尾。

接下来,我通过检查

确保它知道第一行只是标题
#1060 - Duplicate column name 'NULL' 

这很奇怪,因为我无法在第一行看到任何空列。

之前我一直在删除&{34;列附带的":"输入,因为我只能看到它们,所以我试着把它放回去。

这次我得到了以下内容:

#2006 - MySQL server has gone away 

我的CSV文件/ PHPMyAdmin有什么问题?!我被困了!

1 个答案:

答案 0 :(得分:0)

这可能是因为max_allowed_packet

更改my.ini/my.cnf文件。在文件中包含[mysqld]下的单行

max_allowed_packet=500M

现在完成后重启MySQL服务。您可以在mysql中看到它的有用价值:

SHOW VARIABLES LIKE 'max_allowed_packet'

您可以在此处阅读http://dev.mysql.com/doc/refman/5.1/en/packet-too-large.html