Mysql Import and Export

To export table data

mysql> SELECT * INTO OUTFILE 'c:\\exp.csv'
    -> FIELDS TERMINATED BY ','
    -> ENCLOSED BY '"'
    -> ESCAPED BY '\\'
    -> LINES TERMINATED BY '\r\n'
    -> FROM emp;



Now to import the above csv file into other datase.

mysql>load data local infile 'd:\\test.txt' into table emp
->fields terminated by ','
->enclosed by '"'
->lines terminated by '\n'
->(empname,empno);


Comments