Insert into mysql from text file

If you have text file with multiple columns separated by space(or something else). you want to take entries from each row and  insert into MySQL database from a text file.

Following steps should be useful.

input.txt is a text file with below entries

105  bill@<domain.com>
304  lance@<domain.com>
605  foo@<domain.com>
609  bar@<domain.com>

inputfile="input.txt"
cat $inputfile | while read id map; do
echo "INSERT INTO <tablename>(users_id,email,email_map) VALUES ('$id','$map', '$map');"
done | mysql -u<username> -p<password> <database>;