csv

How to import CSV file into MySQL database using command line interface (CLI)

You can easily import CSV files content into MySQL database using mysql console client. You do not need phpmyadmin or other interfaces anymore.

1. Connect to SQL server with command like this:
[root@server user01]# mysql -u db_user -p -h localhost
Prepare CSV file (with columns separated by Tab symbol in case below)
2. Import data into table
mysql> load data local infile 'file.csv' into table test_table fields terminated by '\t' enclosed by '"' lines terminated by '\n' ;

Subscribe to RSS - csv