1
我有一個shell腳本,它具有多個加載數據語句,可以將來自csv文件的數據加載到MySQL中的表中。如何使用GNU Parallel並行執行這些語句?在shell腳本中使用GNU並行執行多個mysql腳本並行
我的shell腳本是這樣的:
#!/bin/bash
mysql --defaults-extra-file=config.cnf -e "SELECT *
FROM table1
INTO OUTFILE '$path/table1.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';"
mysql --defaults-extra-file=config.cnf -e "SELECT *
FROM table2
INTO OUTFILE '$path/table2.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';"
mysql --defaults-extra-file=config.cnf -e "SELECT *
FROM table3
INTO OUTFILE '$path/table3.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY '\n';"
echo "END of script"