Import large csv file using phpMyAdmin

前端 未结 2 934
刺人心
刺人心 2021-01-05 10:01

I have a csv file, a big one, 30 000 rows. I\'ve tried to import it using LOAD file etc.. from the terminal, as I found on google, but it didn\'t work. It was making the imp

相关标签:
2条回答
  • 2021-01-05 10:41

    I got this problem when trying to import a large file using phpMyAdmin, and am also unable to use the command in the version which I am using. To solve this I used this CSV editor and split the file into smaller files. Worked fine when I imported each chunk separately.

    0 讨论(0)
  • 2021-01-05 10:55

    Increase your php's memory limit and script time, that's beacause your executing the mysql instruction through the php server.

    Check your php.ini file for this vars:

    memory_limit
    max_execution_time
    

    But anyway I would do it through the mysql client (terminal), check mysql doc

    LOAD DATA LOCAL INFILE '/path/to/your/csv/file/csv_file.csv' INTO TABLE database_name.table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n';
    

    Mysql Documentation - Load Data Infile Syntax PHP Documentation - Ini core settings

    0 讨论(0)
提交回复
热议问题