| Bug #69345 | Change mysql client default prompt to "mysql (\d)> " | ||
|---|---|---|---|
| Submitted: | 29 May 2013 14:49 | Modified: | 24 Jun 2013 20:15 |
| Reporter: | Morgan Tocker | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S4 (Feature request) |
| Version: | 5.7 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[1 Jun 2013 12:43]
Daniël van Eeden
I think a "mysql [\d] > " prompt would indeed be very good thing. If "(" or "[" is used doesn't really matter. The longer version as used by MySQL sandbox is a bit too long for a default.
The alternative implementation method for this would be to put it in the my-default.cnf file.
[24 Jun 2013 20:15]
MySQL Verification Team
Thank you for the bug report.
[5 Nov 2013 7:16]
Daniël van Eeden
The hostname should only be added to the default prompt if Bug #48286 is fixed. Otherwise it would be 'localhost' in too many cases and not really helpful.

Description: I noticed in MySQL 5.7 that the command line client default changed to show warnings (enabled with \W) by default. Thank you very much for this change! I was wondering if you might consider changing the default prompt from "mysql> " to "mysql (\d)> " so that users will know what current database they have selected. Optionally you could also include the hostname + username as MySQL sandbox does (prompt='mysql [\h] {\u} (\d) > '), but I am not sure if this will confuse people more. How to repeat: mysql> prompt mysql (\d)> PROMPT set to 'mysql (\d)> ' mysql ((none))> use test; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed mysql (test)> Suggested fix: diff -ruN client/mysql.cc.dist client/mysql.cc --- client/mysql.cc.dist 2013-05-29 10:47:48.000000000 -0400 +++ client/mysql.cc 2013-05-29 10:48:10.000000000 -0400 @@ -1217,7 +1217,7 @@ delimiter_str= delimiter; default_prompt = my_strdup(getenv("MYSQL_PS1") ? getenv("MYSQL_PS1") : - "mysql> ",MYF(MY_WME)); + "mysql (\d)> ",MYF(MY_WME)); current_prompt = my_strdup(default_prompt,MYF(MY_WME)); prompt_counter=0;