Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7635665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:29:01+00:00 2026-05-31T07:29:01+00:00

I was requested to do a csv -> mysql insert on CSV Files .

  • 0

I was requested to do a csv -> mysql insert on CSV Files .

They have 20k files of csv that contains from 100 to 100k lines of data .

So here is what i thought i can do :

On my machine i could join all files into 1 using a simple command :

 copy *.csv  combined.csv 

and then process that file and then using php fgetcsv process that file and insert it in the DB .

Or

I could write a php program that read a directory process each file and when done transfer it into another folder .

Dedicated server is available

Good Pc with 8gb of memory available

What do you suggest ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:29:03+00:00Added an answer on May 31, 2026 at 7:29 am

    Use LOAD DATA INFILE. Its better to insert data file by file.

    LOAD DATA INFILE '/path/to/data.csv' 
    INTO TABLE `table` 
    FIELDS TERMINATED BY ',' 
    LINES TERMINATED BY '\n' 
    

    Run in batch mode for 20k files. Put password in command to prevent it from asking.

    #!/bin/bash
    
    for f in /path/to/*.csv;
    do 
        mysql -uroot -pPASSWORD DATABASE \
        -e "LOAD DATA INFILE '$f' 
            INTO TABLE `table` 
            FIELDS TERMINATED BY ',' 
            LINES TERMINATED BY '\n'"
        echo $f is imported ...
    done;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have been requested to stream a single video (+500MB) from a web site.
The wrinkle is that the pages being requested are aspx pages and they are
My code fetches CSV data from a PHP page using httplib. When I open
I have a large CSV file, approx 10 MB in size, which contains all
I'm using ExtJS to make a form that generates a report from the data
I have a request for some contract work from an organization that uses Excel
The users have requested the option to download a csv file representation of GridView
I have csv file having some address data mostly in Finnish language. I need
Inside my view.py, I have two functions, one that processes input from a form
I need to perform a cURL request to grab a CSV file from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.