Software >> Services >> RDBMS >> MySQL >> Command Line >> How to run SQL statements directly from command line

assume we have configured .my.cnf to allow mysql to run with automatic login

mysql -e "USE mydb; SELECT * FROM mytable;"