MySQL LOAD DATA LOCAL INFILE only imports a single row

前端 未结 4 1190
梦谈多话
梦谈多话 2021-01-12 14:00

We have a CSV file with thousands of records in it. I want to import these rows into a MySQL table via phpmyadmin. here is the command used:

load data loca         


        
4条回答
  •  余生分开走
    2021-01-12 14:36

    You say that the ID field has the AUTO_INCREMENT attribute, but there's no mention of it in the CREATE TABLE statement. This is part of the problem.

    The other part is those truncation warnings. Some of the rows in the CSV file probably contain data that is too long to fit inside the columns. Increase the size of those text columns to a bigger value (let's say 200) and try again.

    Are you absolutely sure that the CSV file is valid ? (a.k.a. each row has the same number of values etc.). You should probably check if those strings contain commas (,), although that shouldn't be an issue.

提交回复
热议问题