mysql LOAD DATA INFILE with auto-increment primary key

后端 未结 5 1025
灰色年华
灰色年华 2021-02-19 03:48

I am trying to load a data file into mysql table using \"LOAD DATA LOCAL INFILE \'filename\' INTO TABLE \'tablename\'\".

The problem is the source data file contains dat

5条回答
  •  有刺的猬
    2021-02-19 04:14

    Use the following query in case the csv record is like that

    "21231","234424","My Category","1"

    LOAD DATA LOCAL INFILE 'C:/wamp/www/cakephp/app/webroot/files/product_catalogs/categories.csv' INTO TABLE cats FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' (category_id,parent_id,category,is_leaf)

    I have done that successfully. :)

提交回复
热议问题