Tuesday, February 2, 2021

Loading all CSV files from directory to MySQL

For loading multiple CSV files into a table in MySQL the following command can be used under Linux shell:

for f in *.csv; do     mysql -e "load data LOCAL infile '"$f"' into table schema.my_table" -u your_username --password=your_password; done;

No comments:

Post a Comment