MySQL

【MySQL】CSVファイルをインポートするコマンド

More than 5 years have passed since last update.

# TERMINATED BY 区切り文字

# ENCLOSED BY 囲み文字
LOAD DATA LOCAL INFILE '/tmp/import.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"'

# データを入れるカラムを指定

LOAD DATA LOCAL INFILE '/tmp/import.csv' INTO TABLE table_name FIELDS TERMINATED BY ',' ENCLOSED BY '"' (column1, column2)