Mega Code Archive

 
Categories / MySQL Tutorial / MySQL Utilities
 

Load data to your table

Create a text file myTable.txt containing one record per line. The values are separated by tabs. The order should be consistant with the columns listed in the CREATE TABLE statement. For NULL values, use \N (backslash, capital-N). For example: 1        firstName    lastName    M      \N      1997-12-09 To load the text file myTable.txt into the myTable table, use this command: mysql> LOAD DATA LOCAL INFILE 'c:\\myTable.txt' INTO TABLE myTable LINES TERMINATED BY '\r\n'; mysql>