【问题标题】:Real trouble importing CSV with PHPMyAdmin使用 PHPMyAdmin 导入 CSV 的真正麻烦
【发布时间】:2014-05-23 01:57:10
【问题描述】:

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

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

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,是,01/01/2001 13:09,,否,01/01/2001 13: 09,,,No,,No,,No,,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' 

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

以前我一直在从“包含:”输入的列中删除",因为我只能在某些列上看到它们,所以我试着把它放回去。

这次我得到了以下内容:

#2006 - MySQL server has gone away 

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

【问题讨论】:

    标签: mysql csv import phpmyadmin


    【解决方案1】:

    这可能是因为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

    【讨论】:

      猜你喜欢
      • 2012-08-23
      • 2020-12-23
      • 1970-01-01
      • 2017-04-10
      • 1970-01-01
      • 2014-06-28
      • 2014-08-25
      • 2018-10-29
      • 1970-01-01
      相关资源
      最近更新 更多