Results 1 to 2 of 2
I have a table "users" with the columns "username", firstname", lastname".
I need to insert the data from a text file where each line contain the username, firstname, and lastname ...
- 06-27-2008 #1
MySQL insert script
I have a table "users" with the columns "username", firstname", lastname".
I need to insert the data from a text file where each line contain the username, firstname, and lastname seperated by spaces.
Does anyone know how to write a script for this?
Thanks,
Geese.Registered Linux user # 395739
direplay.com
- 06-27-2008 #2Linux Guru
- Join Date
- Oct 2007
- Location
- Tucson AZ
- Posts
- 1,939
The command below should work for a text file. Change the path to the file, name of file and name of table. When creating the file, I believe there needs to be a tab between each entry, i.e: username (hit tab key) firstname (tab key),etc
mysql> load data infile '/home/geese/Documents/users.txt' into table users;
This has worked for me although sometimes its load infile rather than load data infile??


Reply With Quote