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/