Mysql Color Scheme
Solution 1
Here is pretty much awesome tool https://github.com/dbcli/mycli
Besides syntax highlight it offers completion.
Solution 2
I've spent much time trying to solve that question. It took me nearly a year to solve it :) There is nice option in mysql config called "pager".
I've just published my configs for mysql client and grc (availiable in most nix dists). Check it out on github! https://github.com/nitso/colour-mysql-console
Solution 3
You could use rlwrap if you just want a colour prompt:
% rlwrap --prompt-colour='1;34' mysql
Note: contrary to convention, rlwrap spells colour with a U.
If you want everything in colour, check out acoc - Arbitrary Command Output Colourer. Not sure if it works with interactive programs, you might need to extend it or write your own.
Solution 4
Recently I have started to use the MySQL client inside an independent vim session with conque. You get syntax highlighting and some other extra features from Vim, like nowrap, search, horizontal scrolling, etc.
With :set wrap
:
With :set nowrap
:
If you like Vim I would give it a go:
- Install conque.
- Create a new .vimsql (I like a different vimrc for this).
- Tune it to start conque and mysql by default.
- Tune it to have some good key mappings for mysql.
-
alias mysqlcool="vim -u ~/.vimsql"
(or whatever :))
You can have a look at the vimrc I'm using.
![Cory Collier](https://i.stack.imgur.com/4oshc.png?s=256&g=1)
Cory Collier
Updated on June 14, 2022Comments
-
Cory Collier about 2 years
Is there a way to set a color scheme for the mysql client? It might sound trivial, but I'd like to be able to set some level of colors for terminal client.
-
Cory Collier over 14 yearsehh, I already have a color scheme setup for my terminal. I'm looking for stuff specific to Mysql. For example, if every other row was a diff color, or if the prompt was a diff color, or the headers were a diff color. See where I'm driving here?
-
Neil almost 14 years"color" is just the American way to spell it.
-
Neil almost 14 yearsIt seems you have to do:
rlwrap -a -p'RED' mysql
to get it working properly. Without the -a the prompt doesn't get coloured. -
Matt Curtis almost 14 years@Neil: Sure, "colour" is how Australians spell it when writing, but most developers use "color" by convention for things like this because it avoids all sorts of unnecessary confusion.
-
Darragh Enright over 11 yearsawesome! works a treat on osx (just
brew install grc
first). this makes me very happy :) -
Houssem ZITOUN almost 8 yearsI followed the installation manual, but I did not find config files. "Copy both config files into your home directory"
-
Ostin almost 8 years
-
alexandre-rousseau over 7 yearsPerfect tool! I installed it in a sec
$ sudo apt-get install mycli
and the$ mycli -u root -p root
. -
Cory Collier over 6 yearsI've found this tool recently, and I absolutely love it!
-
Jeff about 6 yearsIMHO you should lead with the acoc answer (which is why I upvoted you). Additionally, the link to rlwrap seems to be timing out.
-
Matt Curtis about 6 years@Jeff thanks for the tip. rlwrap is easier to find on different platforms than acoc. It gets the silver medal though, that’s pretty good right?