MySQL Run SQL Queries directly From Shell

mysql -u user -p -e ‘select * from table_name’ database_name

Where,
-u : Specify mysql database user name
-p : Prompt for password
-e : Execute sql query
database_name : Specify database name

shenno