First of all, the doc says below:
mysql> help
...
ego (\G) Send command to mysql server, display result vertically.
...
go (\g) Send command to mysql server.
...
But, ego or go doesn't work after a SQL statement as shown below:
mysql> SELECT * FROM person
-> ego
Or:
mysql> SELECT * FROM person
-> go
While \G or \g works after a SQL statement as shown below:
mysql> SELECT * FROM person
-> \G
*************************** 1. row ***************************
id: 1
name: John
*************************** 2. row ***************************
id: 2
name: David
Or:
mysql> SELECT * FROM person
-> \g
+----+-------+
| id | name |
+----+-------+
| 1 | John |
| 2 | David |
+----+-------+
So, how can I make ego
or go
work after a SQL statement?
You can use --named-commands or -G with login to make ego or go work after a SQL statement as shown below:
Or:
Or on Windows, you can set
named-commands
under[mysql]
inmy.ini
as shown below. *My answer explains[mysql]
and my answer explains wheremy.ini
is located on Windows:Then, you can log in by setting
my.ini
's location to--defaults-file=
or--defaults-extra-file=
to makeego
orgo
work after a SQL statement as shown below. *--defaults-file=
or--defaults-extra-file=
must be the 1st option otherwise there is the error:Or:
Finally,
ego
orgo
works after a SQL statement as shown below:Or:
In addition,
ego
orgo
doesn't work just after a SQL statement as shown below:Or:
Or:
Or:
While \G or \g works just after a SQL statement as shown below:
Or:
Or:
Or: