Assumes there is a text file, “instances.txt” that has the IP or symbolic name of the server where the instances are Just put the query in quotes at the end of the script (such as pasting the below into runonall.sh)
params=$@
for i in `cat /home/rbyrd2/bin/instances.txt` ; do echo "$i: " ; mysql -h $i -N -B -e "$params" ; done