How to load data from text files

load text image

A comma seperated (CSV) file that’s stored in users.csv

1,John,Smith,jsmith@gmail.com
2,Andrea,Steelman,andi@murach.com
3,Joel,Murach,joelmurach@yahoo.com
      

How to use phpMyAdmin to load data from a CSV file

  1. Start phpMyAdmin, select the database, select the table, and click on the Import tab.
  2. Select the file to import.
  3. Set the options for the import (CSV) and click the Go button.
If you get an error, you can modify the import options and try again.

How to use the linux MySQL command prompt to load data from a CSV file

mysql> load data local infile "users.csv" into table junk;
Query OK, 3 rows affected, 12 warnings (0.00 sec)
Records: 3  Deleted: 0  Skipped: 0  Warnings: 12

mysql> select * from junk;
+----+------+------+------+
| id | fn   | ln   | em   |
+----+------+------+------+
|  0 | NULL | NULL | NULL |
|  2 | NULL | NULL | NULL |
|  3 | NULL | NULL | NULL |
+----+------+------+------+
3 rows in set (0.00 sec)

mysql>  exit;
      

Description

Back