assume we have configured .my.cnf to allow mysql to run with automatic login
mysql -e "USE mydb; SELECT * FROM mytable;"