Tutorial by Examples

Given the tab-separated file employee.txt 1 \t Arthur Dent 2 \t Marvin 3 \t Zaphod Beeblebrox $ mysql --user=user --password=password mycompany -e 'CREATE TABLE employee(id INT, name VARCHAR(100), PRIMARY KEY (id))' $ mysqlimport --user=user --password=password mycompany employee.txt ...
Given the text file employee.txt 1|Arthur Dent 2|Marvin 3|Zaphod Beeblebrox $ mysqlimport --fields-terminated-by='|' mycompany employee.txt
This example is useful for windows-like endings: $ mysqlimport --lines-terminated-by='\r\n' mycompany employee.txt
Given the table Employee idName3Yooden Vranx And the file employee.txt 1 \t Arthur Dent 2 \t Marvin 3 \t Zaphod Beeblebrox The --ignore option will ignore the entry on duplicate keys $ mysqlimport --ignore mycompany employee.txt idName1Arthur Dent2Marvin3Yooden Vranx The --replace opt...
$ mysqlimport --where="id>2" mycompany employee.txt
$ mysqlimport --fields-optionally-enclosed-by='"' --fields-terminated-by=, --lines-terminated-by="\r\n" mycompany employee.csv

Page 1 of 1