Sunday, June 8, 2014

Inserting tuples in MYSQL database through text file in linux

Use command to login to mysql through terminal

root@hotspot:/home/dell#  mysql -u <user-name> -p --local-infile <somedatabase>;

Enter password:

mysql>use <database-name>;
mysql>LOAD DATA LOCAL INFILE '<file path>' INTO TABLE <table-name>;


Data in file should be in order according to Database table.
Data in file should be separated through tab.

No comments:

Post a Comment