- 基本信息
目标表名: t_test(username,password)
目标数据库: test 数据库用户名: yourdbname 数据库密码: yourdbpassword
- Linux
#!/usr/bin/env bashfor f in *.txtdo mysql -e "LOAD DATA LOCAL INFILE '"$f"' INTO TABLE t_test FIELDS TERMINATED BY '||' (username,password)" -u root --password=ghcatest testdone
- Windows
rem 未验证echo offsetlocal enabledelayedexpansionfor %%f IN ("*.txt") do ( set old=%%~dpnxf set new=!old:\=\\! mysql -e "LOAD DATA LOCAL INFILE '"!new!"' INTO TABLE t_test FIELDS TERMINATED BY '||' (username,password)" -u root echo %%~nxf done)