3

how to Export data from csv file into mysql database? is there any Query or some othr way avial?

1

2 Answers 2

2

I think you mean IMPORT., here's how:

load data local infile 'yourCSVfilepath.csv' into table tableNameHERE
fields terminated by ','
optionally enclosed by '"'
lines terminated by '\r\n'
Sign up to request clarification or add additional context in comments.

Comments

1

To Export data to csv from Mysql use this

SELECT *
INTO OUTFILE '/tmp/tablename.csv'
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\n'
FROM tablename

To import csv to Mysql use this

LOAD DATA INFILE 'c:/tablename.csv' INTO TABLE tablename

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.