0

I wanted to give the colorization of MySQL environment a go, so I searched the internet and found this page:

mysql-colorize

I followed both of the two directions and it is now working fine. As I checked the results of SHOW DATABASES; command I figured that it displays the results in another view, returning back by pressing Q button. Because of the fact that I want the results to be shown on the same environment, while containing the command above it (as it is normally done in non-altered MySQL command-line environment), I have decided to remove it and try another one found via the link below:

colour-mysql-console

But unfortunately when I delete the previously made ~/.bash/ folder, MySQL will only show some errors as below:

mysql> SHOW DATABASES;
sh: /home/caracal/.bash/mysql-colorize/mycat: No such file or directory
7 rows in set (0.00 sec)

I would very much like to order MySQL not to pay attention to the deleted .bash folder or its contents and start using the two files brought by colour-mysql-console but I don't know at all where to look at and what file to make any desired changes in, to make my desired effects appear.

Would you please tell me how to fix my problem? Thenk you very much in advance.

  • Have you tried closing the current terminal, and opening another one? So you can have a clean environment? – Zoredache May 26 '17 at 21:14
  • Yes, Sorry to forget to mention the result back to the terminal then: mysql> show databases; Traceback (most recent call last): File "/usr/bin/grcat", line 146, in <module> split(ll['colours'], ',') File "/usr/bin/grcat", line 145, in <lambda> ''.join(map(lambda x: get_colour(x), split(colgroup))), File "/usr/bin/grcat", line 145, in <lambda> ''.join(map(lambda x: get_colour(x), split(colgroup))), File "/usr/bin/grcat", line 82, in get_colour raise ValueError('Bad colour specified: '+x) ValueError: Bad colour specified: whit 7 rows in set (0.00 sec) – Tower May 26 '17 at 21:18
  • It will start working nicely after entering pager more – Tower May 26 '17 at 21:20
1

In mysql-colorize the relevant bits are in /mysql-colorize.bash

alias mysql="mysql --pager=$(dirname $BASH_SOURCE)/mycat"

So to disable it, in the current shell, you would do

unalias mysql
| improve this answer | |
  • Then the same errors occure, and I will have to run the source command again to make it work again: mysql> show databases; Traceback (most recent call last): File "/usr/bin/grcat", line 146, in <module> split(ll['colours'], ',') File "/usr/bin/grcat", line 145, in <lambda> ''.join(map(lambda x: get_colour(x), split(colgroup))), File "/usr/bin/grcat", line 145, in <lambda> ''.join(map(lambda x: get_colour(x), split(colgroup))), File "/usr/bin/grcat", line 82, in get_colour raise ValueError('Bad colour specified: '+x) ValueError: Bad colour specified: whit – Tower May 27 '17 at 7:53
  • And : bash: unalias: mysql: not found, so what I did was : unalias -a – Tower May 27 '17 at 7:57
  • Yes, but the unalias -a would not solve my problem except that it gave me the idea of creating a file, put #!/usr/bin/mysql as the shebang for it and executing it: source ./file_name. Now mysql runs without any errors, displaying the returned data in its default manner. Thank you very much for your idea which helped me solve the problem. – Tower May 27 '17 at 8:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.