Read on. This document will tell you how to run a command line interpreter for mysql. It will lead you to online references for mysql command line. It will tell you how to use the help command that comes with mysql script interpreter. It will speciifically, in detail documents how to load a table from a csv file. You may want to consider this option instead of writing a java program or a php program or others of that ilk.

mysql running a command line help

Search for: mysql running a command line help

mysql\bin\mysql is the command to run

mysql command line how to get help on a specific command

Search for: mysql command line how to get help on a specific command

hopefully this url will give the help


mysql> connect database_name host_name

Another url to help out with the help command


help administration

Administration
   Column Types
   Data Definition
   Data Manipulation
   Functions
   Geographic features
   Transactions

help load

Search for: mysql load data in file

Here is the manual link from mysql

Step by step guide on how to import Excel data using LOAD DATA

Not sure how good it is. something to check

Here's a great way to use LOAD DATA to UPDATEs

here is how to use php for somethign like this

Here is what you need to keep a command line open after running a batch file in windows

You will need this because you want to batch up commands and remember them on your desktop or some sub folder otherwise you can't retype everything when you need again in a trial and error manner.


1.Create a batch file you want. Ex: runmysql.cmd
2.Use windows file explorer to create an icon on the desktop 
    for that ?runmysql.cmd?
3.Change the ?target? property of that icon to reada.       
   cmd.exe /k "C:\somepath\mysql\bin\runmysql.cmd"

c:
cd "c:\somepath\mysql\bin"
call mysql your-database-name < import.txt

delete from some_table_name;

commit;

load data infile 'c:\\work\\somefile.csv' 
into table some_table_name
fields terminated by ','
lines starting by 'imp,' terminated by '\r\n';

commit;

You may want to remove the empty lines if they are causing an issue.


A documentation line
List of table columns
col1,col2,col3,col4
imp,strign1,int1,int2,date1
imp,strign1,int1,int2,date1
imp,strign1,int1,int2,date1
imp,strign1,int1,int2,date1
imp,strign1,int1,int2,date1
The prefix "imp," is specified as the line to import
ignore every other line in the file.