1、查询导入数据存放位置
show variables like '%secure%';
+--------------------------+-----------------------+
| Variable_name | Value |
+--------------------------+-----------------------+
| require_secure_transport | OFF |
| secure_auth | ON |
| secure_file_priv | /var/lib/mysql-files/ |
+--------------------------+-----------------------+
rows in set (0.01 sec)
2、将csv文件放入 secure_file_priv 目录中
3、LOAD DATA local INFILE '/var/lib/mysql-files/20181109-1108' INTO TABLE retailers.order_20180822_1108 character set utf8 FIELDS TERMINATED BY ',' LINES TERMINATED BY ' ';
FIELDS TERMINATED BY:分隔符
LINES TERMINATED BY:换行符
查看mysql物理存放位置
show global variables like "%datadir%";
导入时表名不能又中横杠 -