MySQL 如何在mysql命令行中垂直显示记录?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11134569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 13:55:05  来源:igfitidea点击:

How to show records vertically in mysql command line?

mysqlcmdcommand-prompt

提问by AZinkey

First explaining what is on my mind {I'm not good at English}

首先解释我的想法{我不擅长英语}

On Alan Storm'sblog, I found a tricky thing about mysql. I am not sure if he's using the command line or not. The comment section has closed over there, so I'm putting this query here instead.

Alan Storm 的博客上,我发现了一个关于 mysql 的棘手问题。我不确定他是否在使用命令行。那边的评论区已经关闭了,所以我把这个查询放在这里。

mysql> select * from eav_entity_type\G

When I run this statement in my command line (Window dos based cmd) I just return normal select statement results.

当我在命令行(基于 Window dos 的 cmd)中运行此语句时,我只返回正常的 select 语句结果。

Please let me know how could I get result as shown in that blog or if it is just part of a code beautifier.

请让我知道如何获得该博客中所示的结果,或者它是否只是代码美化器的一部分。

回答by Ravinder Reddy

I think you are using \ginstead of \G. Unless you use \Gyou get default output pattern. Default is \g.

我认为您正在使用\g而不是\G. 除非您使用,否则您将\G获得默认输出模式。默认为\g

mysql> show databases\g
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql> show databases\G
*************************** 1. row ***************************
Database: information_schema
*************************** 2. row ***************************
Database: mysql
*************************** 3. row ***************************
Database: test
3 rows in set (0.00 sec)

回答by Matijs

Maybe you are using an older version of MySQL? \Gis a shortcut for the MySQL ego command and should work on your system as well.

也许您使用的是旧版本的 MySQL?\G是 MySQL ego 命令的快捷方式,应该也适用于您的系统。

See: http://dev.mysql.com/doc/refman/5.5/en/mysql-commands.html

请参阅:http: //dev.mysql.com/doc/refman/5.5/en/mysql-commands.html

And it works fine with vertical display on on my system.

它在我的系统上垂直显示时工作正常。