A chronological documentation test project, nothing serious, really!

07 May 2007 Import csv data to mysql

Posted by

This is a short note about how to import comma separated data, CSV, from a file into a mysql database from a shell.

  1. Log in to your mysql database and choose the database you are going to import into.
  2. Type in the following in the mysql console to import from the CSV file
    load data infile '/home/username/data.csv' into table program fields terminated by ';' lines terminated by '\r\n';

Tags: , , ,

Comments are closed.