在mysql中,多个CSV文件导入到一个表的方法

时间:2021-12-01 00:40:21
@echo off 
cd C:\ProgramData\MySQL\MySQL Server 5.7\Uploads
for /R "C:\ProgramData\MySQL\MySQL Server 5.7\Uploads" %%s in (*.csv) do ( 
echo %%s 
copy "%%s" tmp.csv
del "%%s"   
"C:\\Program Files\\MySQL\\MySQL Server 5.7\\bin\\mysqlimport.exe" --local --fields-terminated-by="," -u*** -p*** database_name tmp.csv
del tmp.csv
)
pause