1、sql命令
#第一行.csv文件就是你要導入的文件
#第二行就是你要插入的表
#第三行表明數據之間以,號分割
#第四行表示數據以換行結束
ps:下面的是一條sql語句
1 load data infile '.csv文件' 2 into table `table` 3 fields terminated by ',' 4 lines terminated by '\r\n';
2、當執行語句報錯
報錯信息如下:
The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
3、執行如下命令
1 show variables like '%secure%'
4、將要導入的.csv文件到此路徑下
將你自己的要導入的.csv文件放到此路徑下
5、執行第一步的代碼如圖(使用的navicate連接工具)