Is it possible to display query results like below within mysql shell?

是否可以在mysql shell中显示如下的查询结果?

mysql> select code, created_at from my_records;
    code         created_at
1213307927  2013-04-26 09:52:10
8400000000  2013-04-29 23:38:48
8311000001  2013-04-29 23:38:48
3 rows in set (0.00 sec)

instead of

mysql> select code, created_at from my_records;
+------------+---------------------+
|     code   |          created_at |
+------------+---------------------+
| 1213307927 | 2013-04-26 09:52:10 |
| 8400000000 | 2013-04-29 23:38:48 |
| 8311000001 | 2013-04-29 23:38:48 |
+------------+---------------------+
3 rows in set (0.00 sec)

The reason I'm asking because I have some tedious task that I need to copy the output and paste it on other tool.

我问的原因是因为我需要复制输出并将其粘贴到其他工具上,这是一项繁琐的工作。

5 个解决方案

#1


16

--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.

对于表格输出,列周围的“装箱”可以将一个列值与另一个列值区分开来。对于非表格输出(例如以批处理模式或在给出--batch或--silent选项时生成),特殊字符将在输出中转义,以便可以轻松识别它们。换行符,制表符,NUL和反斜杠写为\ n,\ t,\ 0和\\。 --raw选项禁用此字符转义。

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 -s
mysql> SELECT CHAR(92);
CHAR(92)
\\

% mysql -s -r
mysql> SELECT CHAR(92);
CHAR(92)
\

From MySQL Docs

来自MySQL Docs

更多相关文章

  1. 格式化mysql表引入Attendace表格格式
  2. php怎么读取MYSQL数据到radio选项
  3. MySQL表格查询基本语句2
  4. 如何在HTML选择选项列表中保留空间hi
  5. 如何让react-native Picker保持新选择的选项?
  6. 可编辑的jquery表格插件
  7. 如何为select中的选项创建?
  8. EasyUI-datagrid表格(基本使用)
  9. 将(重度公式加载的)Excel电子表格转换为用户友好的网络计算器

随机推荐

  1. C++如何给二维数组初始化
  2. 什么是Go语言?Go语言的优缺点介绍
  3. 一个c程序的执行是从哪里开始到哪里结束
  4. devc++怎么改成中文
  5. 在c语言中引用数组元素时,其数组下标的数
  6. c++中=和==的区别有哪些?
  7. 在c程序中,注释语句只能位于一条语句的后
  8. c++中不能重载的运算符有哪些
  9. c语言语句以什么结束
  10. textbox控件属性有哪些