If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Importing .csv into mysql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-15-10, 19:07
Diesel Dud Diesel Dud is offline
Registered User
 
Join Date: Feb 2010
Location: Montreal, CA
Posts: 32
Importing .csv into mysql

I am looking to import a local .csv file into my online mysql database.
I have already used phpmyadmin to simply "import" /csv files, but I would like a more automated method to do this.

I thought a .bat file could work, but I am not very familiar with the syntax.

I am also considering a stored proc. since I am comfortable with SQL, although I am unfamiliar with the syntax to get the .csv file.

What are your recommendations?

Ideally, this would eventually become a scheduled job, although it is not the priority for the moment.

The job will be a recurring event, possibly with different .csv filenames and/or different db table names.

Thanks.
Reply With Quote
  #2 (permalink)  
Old 05-26-10, 10:34
socaroka socaroka is offline
Registered User
 
Join Date: May 2010
Posts: 1
There are some cool tools like CSV to MySQL that make it easy to import and export CSV files to and from MySQL - but changing the filenames and database tables on an automated job sounds like a tall order. Maybe you need a custom script.
Reply With Quote
  #3 (permalink)  
Old 05-26-10, 14:37
Diesel Dud Diesel Dud is offline
Registered User
 
Join Date: Feb 2010
Location: Montreal, CA
Posts: 32
Quote:
Originally Posted by socaroka View Post
There are some cool tools like CSV to MySQL
thanks a lot ill look into this
Reply With Quote
  #4 (permalink)  
Old 06-02-10, 21:06
Mohsinkhan Mohsinkhan is offline
Registered User
 
Join Date: Jun 2010
Posts: 4
as u want to load a csv file into db.
--u can use "load data infile my.txt into table table1 fields terminated by ',' "

--to automate this job for a 'table' with a 'filename' u can write a shell script which calls the above SQL statement which loads the data and run the script through crontab.

--if ur not using linux shell script follow this procedure in .bat file as i dont know how .bat works or its syntax
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On