MYSQL插入数据:
LOAD DATA INFILE '/home/test/dump/ip_location.csv'
INTO TABLE ip_location
CHARACTER SET utf8
FIELDS TERMINATED BY ',' ENCLOSED BY '"';
--CHARACTER SET :mysql字符集,一定要加上,免去乱码麻烦
--INTO TABLE :导入到哪个表
--FIELDS TERMINATED BY :以什么作为分割符
-- ENCLOSED BY :被什么包围
错误:
mysql 插入数据时Error Code: 1290. The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 0.00023 sec
解决:
show variables like '%secure_file_priv%';
然后把要导入的数据文件放到该文件夹。我这里是/var/lib/mysql-files/