Results 1 to 6 of 6
Hi, im quite a newbie when it comes to MySQL but i heard that its possible to import data from a CSV into a mysql table.
Can anyone enlighten me ...
- 11-16-2010 #1Just Joined!
- Join Date
- Nov 2010
- Posts
- 61
How to import CSV into MySQL??
Hi, im quite a newbie when it comes to MySQL but i heard that its possible to import data from a CSV into a mysql table.
Can anyone enlighten me on how to do it please? Im running CentOS and usiong MySQL Workbench to connect and run queries.
I have my CSV formatted so that the first row has the names of my columns on the table that I want to import it to and the following rows are the data that needs importing.
Cheers,
Chris,
- 11-17-2010 #2Just Joined!
- Join Date
- Mar 2010
- Location
- India
- Posts
- 2
Hey try this out ..
LOAD DATA LOCAL INFILE 'uniq.csv' into table tblUniq
fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(uniqName, uniqCity, uniqComments)
Note:Place the 'data.csv' file into the mysql databases directory before executing the command.
- 11-17-2010 #3Just Joined!
- Join Date
- Nov 2010
- Posts
- 61
- 11-17-2010 #4
Never touch the database files themselves! You'll corrupt the database.
Enter the database with the following command:
mysql -u database_username -p name_of_database
You'll be prompted for the database password, then you can type crazyswap's commands from the mysql> prompt
- 11-17-2010 #5Just Joined!
- Join Date
- Mar 2010
- Location
- India
- Posts
- 2
/var/lib/mysql/
- 11-17-2010 #6


Reply With Quote
