?
Solved

import multiple data files using mysql's LOAD DATA INFILE statement from the command line.

Posted on 2008-10-07
1
Medium Priority
?
2,615 Views
Last Modified: 2012-05-05
I am trying to import not just one but numerous flatfile csv files using LOAD DATA INFILE statement from the mysql command line.  Using the code ive posted below i can insert a single .csv file but I need to be able to insert all .csv files that are in the same directory.  

Ive tried using *, %, and .*\  as wildcard operators but none of them have worked.


mysql --user=username --password=mypassword LOAD DATA LOCAL INFILE 'c:\\\files\\\\\\date20080808.txt.csv' INTO TABLE mytable FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' (field1, field2, field3)

Open in new window

0
Comment
Question by:cebrooks03
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 51

Accepted Solution

by:
Steve Bink earned 2000 total points
ID: 22665874
http://dev.mysql.com/doc/refman/5.1/en/load-data.html

The docs do not specifically state it, but I believe it is designed to read a *single* text file.  To import multiple files, you would execute multiple command lines - one for each file.
0

Featured Post

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question