Colour mysql shell prompt
Hello,
How can I colour the mysql shell prompt using grc?
I change the mysql shell prompt using this:
export MYSQL_PS1="mysql_\d>_"
which result on:
mysql [database]>
I want to colour the database name.
Hello.
There is a trick described in https://superuser.com/questions/397183/mysql-command-line-color-prompt
~MySQL client does not support standard bash color sequences, so~ you have to use alias wrapper. I'll commit an example later, thanks.
Update: you can use color sequences in mysql promt. That works on my machine:
export MYSQL_PS1=$(echo -e "\033]0;\u@\h [\d]\007\u@\h [\d]> ")
Hello,
Thank you for responding to our question. I try the referenced link and the suggested export but doesn't work in my mac... :(
Do you have any colors in your terminal? I guess it could be swittched off. You can try to check information there: https://stackoverflow.com/questions/1550288/os-x-terminal-colors
I don't have mac right now, so I can't test it myself.
Yes, I have colors in my terminal. I try different suggestions from different sources trying to color MySQL prompt but nothing work. That's why I create this issue/question since your GitHub for color MySQL prompt work excellent...
This works only for mysql client using readline (<=5.6.4).
Use mysql --version to check.
@arsari @nitso