Display query results without table line within mysql shell ( nontabular output )

--raw, -r

For tabular output, the “boxing” around columns enables one column value to be distinguished from another. For nontabular output (such as is produced in batch mode or when the --batch or --silent option is given), special characters are escaped in the output so they can be identified easily. Newline, tab, NUL, and backslash are written as \n, \t, \0, and \\. The --raw option disables this character escaping.

The following example demonstrates tabular versus nontabular output and the use of raw mode to disable escaping:

% mysql
mysql> SELECT CHAR(92);
+----------+
| CHAR(92) |
+----------+
| \        |
+----------+

% mysql --silent
mysql> SELECT CHAR(92);
CHAR(92)
\\

% mysql --silent --raw
mysql> SELECT CHAR(92);
CHAR(92)
\

From MySQL Docs


Not exactly what you need, but it might be useful. Add \G at the end of the query

select code, created_at from my_records\G;

Query result will look like this:

*************************** 1. row ***************************
 code: 1213307927
 created_at: 2013-04-26 09:52:10
*************************** 2. row ***************************
 code: 8400000000  
 created_at: 2013-04-29 23:38:48

You need to pass the -s parameter mysql -s.


One-liner

mysql -u YOURUSER -p --password=YOURPASSWORD -s -r -e "show databases;"        
mysql -u root -p --password=abc12345 -s -r -e "show databases;"

Tags:

Mysql

Sql