Import multiple csv files

from the Artful MySQL Tips List


Substitute your path, database and table for yourpath, yourDB and yourtable in ...
#!/usr/bin/env bash
cd yourpath
for f in *.csv
do
  mysql -e "USE yourDB LOAD DATA LOCAL INFILE '"$f"'INTO TABLE yourtable"
done



Return to the Artful MySQL Tips page