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.

satya - Monday, September 12, 2011 2:41:28 PM

mysql running a command line help

mysql running a command line help

Search for: mysql running a command line help

satya - Monday, September 12, 2011 3:23:34 PM

mysql\bin\mysql is the command to run

mysql\bin\mysql is the command to run

satya - Monday, September 12, 2011 3:23:57 PM

mysql command line how to get help on a specific command

mysql command line how to get help on a specific command

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

satya - Monday, September 12, 2011 3:25:58 PM

hopefully this url will give the help

hopefully this url will give the help

satya - Monday, September 12, 2011 3:38:18 PM

connect command


mysql> connect database_name host_name

satya - Monday, September 12, 2011 3:40:24 PM

Another url to help out with the help command

Another url to help out with the help command

satya - Monday, September 12, 2011 3:41:36 PM

Example


help administration

satya - Monday, September 12, 2011 3:42:04 PM

other help categories are


Administration
   Column Types
   Data Definition
   Data Manipulation
   Functions
   Geographic features
   Transactions

satya - Monday, September 12, 2011 3:44:49 PM

you can do this


help load

satya - Monday, September 12, 2011 3:55:57 PM

mysql load data in file

Search for: mysql load data in file

satya - Monday, September 12, 2011 3:56:38 PM

Here is the manual link from mysql

Here is the manual link from mysql

satya - Monday, September 12, 2011 4:00:07 PM

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

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

Not sure how good it is. something to check

satya - Monday, September 12, 2011 4:01:36 PM

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

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

satya - Monday, September 12, 2011 4:04:04 PM

here is how to use php for somethign like this

here is how to use php for somethign like this

satya - Tuesday, September 13, 2011 4:19:00 PM

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

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.

satya - Tuesday, September 13, 2011 4:20:42 PM

Here is an example


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"

satya - Tuesday, September 13, 2011 4:21:49 PM

Here is an example runmysql.cmd


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

satya - Tuesday, September 13, 2011 4:24:10 PM

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.

satya - Tuesday, September 13, 2011 4:26:45 PM

A sample csv file


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.