# Load an entire file onto a mysql table

Last updated:

Suppose you have a text file with thousands of names, each on a line, like this:

John
Philip
Jane
Paula
Mark


There's a simple way to load all of them onto a MySQL table, but few know about it:

mysql -u <username> -p


Select the database you want to use:

use mydb;


LOAD DATA LOCAL INFILE '/home/<name>/textfile' into table persons(name);