Bug #41723 Instance naming for client-side idenification
Submitted: 23 Dec 2008 22:21
Reporter: Shawn Green Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:any OS:Any
Assigned to: CPU Architecture:Any

[23 Dec 2008 22:21] Shawn Green
With the use of multiple instances per server, there needs to be a way to identify each server accurately, preferably on the command line, to avoid possible confusion when logged in locally, via the Command Line Interface (CLI). 

The \h option does not work as it always returns 'localhost'

The \U option does not work as the same login can be used on multiple instances. 

The -p option will return the local socket but this will return only a port number for remote connections. 

How to repeat:
Have one of your friends connect you to one of several instances running on a machine with the Command Line Interface (mysql) using a local socket. Figure out which server you are on. 

Suggested fix:
Fix the CLI and or the server so that each instance could be tagged by the administrators and have that tag recognized by the prompt command of the CLI. 

If the server is called "bugs.mysql.com" then I would like the option to see:


in my prompt (cutoff all first and second-tier URL components) even if I connected via a local socket. 

One way to do this would have the CLI show part or all of the @@hostname variable or some other server-side variable once it makes it's initial connection. 

This way, the same client prompt could be used to accurately identify all servers regardless of if they are local or remote. 

This solution would need to work for multi-homed servers as well. Let's say that for argument's sake I run 5 instances of MySQL all on different IP addresses from the same box all using port 3306. I would need this prompt to reflect to me which of these instances I am connected to at any one time.