Load CSV file to mySql Table

Steps/Commands to load CSV file to existing mySql Table: 
1. Create Table : myTable 
create table mytable ( 
c1 varchar(10), 
c2 varchar(10),
c3 varchar(10) 



2. Create CSV file : /var/tmp/myCSV.csv [make sure about the permissions of this file]

1,mumbai,1
2,osaka,1
3,tokyo,2

3. Use below commands to load CSV file
(select database and use SQL section / use command line)
load data local infile '/var/tmp/myCSV.csv' into table tbl fields terminated by ','

1 comment :

  1. All the information is awesome and so nice this post is really helpful. Please Visit:

    retail management
    cash register
    pharmacy software

    ReplyDelete