Execute query
# Execute queries from string. $mysql -hLOCALHOST -uROOT -pPASSWORD DBNAME -e "SELECT 1 as Header; SELECT 1" +--------+ | Header | +--------+ | 1 | +--------+ +---+ | 1 | +---+ | 1 | +---+ # Execute queries from file. $mysql -hLOCALHOST -uROOT -pPASSWORD < queries.sql
Get results with no formatting
mysql --skip-column-names --silent -hLOCALHOST -uROOT -ppassword DBNAME -e "SELECT 1 as Header"
--skip-column-names
: Will not display the column header name.--silent
: Will not display the cell's border.
Output
1