Importing CSV to mysql
Something pretty straight forward..
if i have a csv as shown below
to import to mysql
1) go to the directory of the csv file. e.g. words.csv
“airy”
“amused”
“animated”
“beatific”
“blissful”
“blithe”
“bright”
“brisk”
“buoyant”
“cheerful”
3) go into mysql admin
mysql -u root -p
4) run command
>LOAD DATA INFILE “./words.csv” INTO TABLE happy FIELDS TERMINATED BY “,” OPTIONALLY ENCLOSED BY “”"” TERMINATED BY ‘\n’;
the words.csv is saved under /var/lib/mysql.
5) and its done.
mysql> select * from happy;
+—————-+
| name          |
+—————-+
| airy               |
| amused       |
| animated     |
| beatific        |
| blissful          |
| blithe            |
| bright           |
Related posts:
- Unable to connect to the database:The MySQL adapter “mysql” is not available. Unable to connect to the database:The MySQL adapter "mysql" is...
- MySql Error in ubuntu solving mysql error of error 1045 Access denied for user...
- Import and Export Mysql Database Importing and Exporting Mysql Database...
