We are execute MySQL queries directly from Linux shell by providing username, password and database name along with the query.
Example is given below.
#mysql -u USERNAME -pPASSWORD DATABASE -e "select `name` from profile"
Note that here the query contains back quotes to specify one field. The back tick character must either be escaped when executing sql from the shell. Otherwise it will fail with error.
So the correct syntax is,
#mysql -u USERNAME -pPASSWORD DATABASE -e "select \`name\` from profile"