I need this within an hour. Don't bid if you can't help get this within timeframe.
I need help on making a shell script work on a linux server that will load multiple files from a specified directory into a mysql database table. Basically loop through all files in a directory. I need it to produce an output file of results.
here is a script I found but not sure how to create it and output file. what I have so far and need help on how to create, run and stop it if needed.
This is a multiple instance of mysql so to invoke the one I want I have to type this on command line: mysql --socket=/opt/mysql/database/mysql_3306/[login to view URL] -p
This should help in the script.
for f in /var/lib/mysql/[insert name of database here]/*.csv
do
mysql -e "LOAD DATA INFILE '"$f"' INTO TABLE [nameoftable] FIELDS TERMINATED BY ',' LINES TERMINATED BY ';'" -u [username] --password= [password] [name of database]
echo "Done: '"$f"' at $(date)"
done
I have ample experience in Bash programming/scripting having all my own Linux nodes (over 12 of them) for hosting purposes. This shouldn't take long at all once we are into SSH.