[MDEV-505] feature request: add \H option for mysql client prompt Created: 2012-09-05  Updated: 2016-10-30  Resolved: 2016-05-10

Status: Closed
Project: MariaDB Server
Component/s: Scripts & Clients
Fix Version/s: 10.2.1

Type: Task Priority: Major
Reporter: Kolbe Kegel (Inactive) Assignee: Sergey Vojtovich
Resolution: Fixed Votes: 1
Labels: contribution, foundation

Issue Links:
Relates
relates to MDEV-11175 \H option does not replace localhost ... Closed
Sprint: 10.2.0-6, 10.2.0-7, 10.2.1-1

 Description   

Please add a \H option for the mysql client prompt, as discussed at http://blog.wl0.org/2009/08/mysql-hostname-prompt-when-host-is-localhost/

This should show the value of the server's "hostname" variable in the prompt of the client connected to the server.



 Comments   
Comment by DELETEME [ 2016-03-08 ]

Hello,

I implemented this here: https://github.com/MariaDB/server/pull/163

Best regards,
Dan Ungureanu

Comment by Sergey Vojtovich [ 2016-05-04 ]

serg, I reviewed this patch and I have no strong opinion. The patch as such is fine. Though similar effect can be achived with MYSQL_PS1 or --prompt="...". Also there was concern that it won't be meaningful for multiple instances are running on same hosts.

Comment by Sergei Golubchik [ 2016-05-09 ]

I'm neutral about it too. MYSQL_PS1 doesn't solve the case when one connects from the same host both to localhost and to remote hosts. For multiple instances one can use \H:\p.

I don't like it because it's a very limited solution. \h prints “localhost”, \H would print, say, “myhost.mynet”. And then another user will come and ask for “localhost (at myhost.mynet)”. And for \H:\p there can be many variations too.

But ok, as it certainly makes no sense to have a complex language just to specify a prompt, I'm fine with adding \H.

Just fix the patch not to do gethostbyname() every time when a prompt needs to be printed.

Generated at Thu Feb 08 06:29:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.