MYSQL import data from csv using LOAD DATA INFILE

前端 未结 11 1437
感动是毒
感动是毒 2020-11-22 09:12

I am importing some data of 20000 rows from a CSV file into Mysql.

Columns in the CSV are in a different order than MySQL table\'s columns. How to automatically assi

11条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-22 09:58

    let suppose you are using xampp and phpmyadmin

    you have file name 'ratings.txt' table name 'ratings' and database name 'movies'

    if your xampp is installed in "C:\xampp\"

    copy your "ratings.txt" file in "C:\xampp\mysql\data\movies" folder

    LOAD DATA INFILE 'ratings.txt' INTO TABLE ratings FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES;
    

    Hope this can help you to omit your error if you are doing this on localhost

提交回复
热议问题