Description:
With mysql you can set the prompt with MYSQL_PS1 or "\R", but you can't set the window title to something useful.
It can be done manually by running
\! echo -ne "\033]2;SOME TITLE HERE\007"
(and then "\c as the client gets confused by the ;)
How to repeat:
Start mysql client and check the window title.
Is it useful? How can it be changed to something useful?
Suggested fix:
Do something like this from mysql (and mysqldump, etc.?)
======================================================
#include <stdio.h>
void main() {
printf("Now changing the terminal title...\n");
printf("\033]2;myuser@myhost:mydb\007");
fflush(stdout);
sleep(3);
}
======================================================
Be aware of things like Bug #25143
Maybe add an config option in the mysql or client section for this.
I don't know if this works on windows with cmd.exe, PowerShell and/or Console2.
For screen it sets the window title, but it doesn't change the session title.
Maybe add an client command:
mysql> windowtitle \u@\h
mysql> \A mysql-dev
Some very very basic concept:
======================================================
diff --git a/client/mysql.cc b/client/mysql.cc
index 450bda0..ed13e35 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -1208,6 +1208,7 @@ int main(int argc,char *argv[])
getenv("MYSQL_PS1") :
"mysql> ",MYF(MY_WME));
current_prompt = my_strdup(default_prompt,MYF(MY_WME));
+ printf("\033]2;%s\007", current_prompt);
prompt_counter=0;
outfile[0]=0; // no (default) outfile
======================================================