Import csv:
load data infile '/test.csv' into table table_name
fields terminated by ',' optionally
enclosed by '"' escaped by '"'
lines terminated by '\r\n'
ignore 1 lines;
Guide csv:
SELECT * INTO OUTFILE '/test.csv'
FIELDS TERMINATED BY ',' OPTIONALLY
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM table_name;
Solve the problem of exporting csv Chinese garbled code:
Open csv with txt, save it as, and select utf8 to encode.
Solve the import problem:
mysql installation directory my. ini, add the following parameters:
[client] default-character-set=utf8
[mysqld] default-storage-engine=INNODB character-set-server=utf8 collation-server=utf8_general_ci
Restart the mysql service.