首先設置: SET GLOBAL local_infile = true;
執行 load data infile 'D:\GoodsDataLinkageMgt_CategoryInfo.csv'into table product_category fields terminated by ',';
load data infile 中間不能存在 'local'關鍵字。我的mysql版本是8.0
如果出現 The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 的提示,那麼修改mysql.ini配置,將可以upload文件的目錄改爲空,比如:secure_file_priv =
或者查看 SHOW VARIABLES LIKE "secure_file_priv"; 將文件複製到該目錄下。
如果出現:ERROR 1300 (HY000): Invalid utf8mb4 character string: '??\05F0/',注入此類的提示,那麼將cvs用文本編輯器重新另存爲的時候選擇編碼格式爲utf-8.