I manage several mysql servers and often on these servers for security reasons the SUPER account is not allowed external network access, so access is made to localhost. When connecting to several hosts at the same time, for example from different ssh sessions, this can be inconvenient as the \h prompt only ever shows localhost and not the hostname of the server to which I’m connected.
The following small patch against 5.1.36 which can also be found here adds a new \H option which behaves the same as \h except in this case the hostname is shown.
diff --git a/Docs/mysql.info b/Docs/mysql.info index 7747201..dffacfd 100644 --- a/Docs/mysql.info +++ b/Docs/mysql.info @@ -20512,6 +20512,8 @@ sequences. `\D' The full current date `\d' The default database `\h' The server host +`\H' Same as `\h' except that if the server host is …[Read more]