Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colour mysql shell prompt #9

Open
arsari opened this issue Dec 12, 2017 · 5 comments
Open

Colour mysql shell prompt #9

arsari opened this issue Dec 12, 2017 · 5 comments

Comments

@arsari
Copy link

arsari commented Dec 12, 2017

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.

@nitso
Copy link
Owner

nitso commented Jan 12, 2018

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]> ") 

@arsari
Copy link
Author

arsari commented Jan 12, 2018

Hello,

Thank you for responding to our question. I try the referenced link and the suggested export but doesn't work in my mac... :(

@nitso
Copy link
Owner

nitso commented Jan 12, 2018

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.

@arsari
Copy link
Author

arsari commented Jan 13, 2018

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...

@biao-biao
Copy link

This works only for mysql client using readline (<=5.6.4).
Use mysql --version to check.
@arsari @nitso

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants