Bug #99386 mysql --prompt new sequence for serverside-hostname
Submitted: 28 Apr 2020 10:07 Modified: 29 Apr 2020 4:55
Reporter: Tsubasa Tanaka (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S4 (Feature request)
Version:5.6, 5.7, 8.0.20 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[28 Apr 2020 10:07] Tsubasa Tanaka
Description:
This is feature request to add new special-sequence "\H" for printing hostname in global_variables.

Now we can use "\h" but this is "hostname which specified by mysql client".
  - https://dev.mysql.com/doc/refman/8.0/en/mysql-commands.html

$ ./mysql -h localhost -S /usr/mysql/8.0.20/data/mysql.sock -uroot --prompt="\h> "

localhost> SELECT @@hostname;
+---------------+
| @@hostname    |
+---------------+
| 150-95-141-50 |
+---------------+
1 row in set (0.00 sec)

"\H" which I patched is getting hostname in global_variables.

$ ./mysql -S /usr/mysql/8.0.20/data/mysql.sock -uroot --prompt="\H> "

150-95-141-50> SELECT @@hostname;
+---------------+
| @@hostname    |
+---------------+
| 150-95-141-50 |
+---------------+
1 row in set (0.00 sec)

This is useful to people who log-in MySQL from localhost, such as DBA.

How to repeat:
This is Feature Request.

Suggested fix:
See attached patch.
[28 Apr 2020 10:08] Tsubasa Tanaka
Patch for MySQL 8.0.19

(*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

Contribution: bug99386.patch (application/octet-stream, text), 882 bytes.

[29 Apr 2020 4:55] MySQL Verification Team
Hello tanaka-San,

Thank you for the report and contribution.

regards,
Umesh