This simple bash script will execute a query 100 times against a MySQL instance. It also uses the time command to report how long the entire process took. I use this for some very simple bench-marking.

The query used here creates a temporary table and inserts 100K rows into it. You need the sequence engine installed.

time (for i in {1..100} ; do mysql -h -u root -p$PWD -P3001 -D tmp -e "CREATE TEMPORARY TABLE tmp$i (id INTEGER NOT NULL PRIMARY KEY); INSERT INTO tmp$i SELECT * FROM seq_1_to_100000;"; done);

Output will look something like below..

real	0m50.205s
user	0m0.492s
sys	0m0.453s