Posts Tagged ‘import’

Import and Export Mysql Database

April 16th, 2009

Found this pretty useful

For exporting DB:

mysqldump -u username -ppassword database_name > FILE.sql

while importing DB:

mysql -u username -ppassword database_name < FILE.sql

 easy but useful.. =) oh.. and got it on this site: Clockwatchers thanks. =)

Finally seeing the light.. =)

VN:F [1.9.6_1107]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)
DiggTwitterTechnorati FavoritesRedditNewsVineFacebookShare

Importing CSV to mysql

March 17th, 2009

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            |

VN:F [1.9.6_1107]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.6_1107]
Rating: 0 (from 0 votes)
DiggTwitterTechnorati FavoritesRedditNewsVineFacebookShare
Get Adobe Flash playerPlugin by wpburn.com wordpress themes