I'm working on a script to check the status of several remote MYSQL hosts by logging into the every server and recording whether the login has been successful or not. The idea is to store the login details for the MYSQL hosts in a CSV file and get the script to loop through this file, login and record if login has been successfull.
The MYSQL Login data stored in the CSV file would the following:
Being a novice at bash scripting, I'm having trouble understanding on how it's best to approach the part where the script loops through a CSV to obtain MYSQL details. Can anyone help?
Currently I tested the below for individual MYSQL Hosts
mysql -h$host -=$user -p$pass -d$db -e exit if [ "$?" -eq "0" ] then echo "Connection established" else echo "Connection not established" fi
Thanks in advance.