MYSQL import data from csv using LOAD DATA INFILE

前端 未结 11 1608
感动是毒
感动是毒 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:48

    I was getting Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

    This worked for me on windows 8.1 64 bit using wampserver 3.0.6 64bit.

    Edited my.ini file from C:\wamp64\bin\mysql\mysql5.7.14

    Delete entry secure_file_priv c:\wamp64\tmp\ (or whatever dir you have here)

    Stopped everything -exit wamp etc.- and restarted everything; then punt my cvs file on C:\wamp64\bin\mysql\mysql5.7.14\data\u242349266_recur (the last dir being my database name)

    executed LOAD DATA INFILE 'myfile.csv'

    INTO TABLE alumnos

    FIELDS TERMINATED BY ','

    ENCLOSED BY '"'

    LINES TERMINATED BY '\r\n'

    IGNORE 1 LINES

    ... and VOILA!!!

提交回复
热议问题