Tutorial on setting prompt implementation information prompt in MySQL

Source: Internet
Author: User
Tags diff git clone
Then let's see what it looks like by default.

Let's see what it looks like after using the prompt parameter.

Then let's look at how black technology works.

Now let's talk about the last color display method. By default, after the -- prompt parameter is used, the color is not displayed. To display the color, we need to use the system function,
Root@GCE-Node1_www.dwhd.org ~ # Awk '/mariadb /'. bashrc alias mysql = $ (echo-e '/usr/local/mariadb-galera/bin/mysql-uroot-p *****-h127.0.0.1-S/tmp/mysql. sock-D mysql -- prompt = "\ x1B [31m \ u \ x1B [34m @ \ x1B [0 m [\ D]: \ x1B [32mGCE-Node1_www.dwhd.org \ x1B [0 m: \ x1B [31 m (\ d) \ x1B [36m \ x1B [0 m> "') [root@GCE-Node1_www.dwhd.org ~] # Alias mysql = $ (echo-e '/usr/local/mariadb-galera/bin/mysql-uroot-p *****-h127.0.0.1-S/tmp/mysql. sock-D mysql -- prompt = "\ x1B [31m \ u \ x1B [34m @ \ x1B [0 m [\ D]: \ x1B [32mGCE-Node1_www.dwhd.org \ x1B [0 m: \ x1B [31 m (\ d) \ x1B [0 m> "')

 

Splitting description
Alias mysql = $ () # set the alias echo-e '/usr/local/mariadb-galera/bin/mysql-uroot-p *******-h127.0.0.1-S/tmp/mysql. sock-D mysql -- prompt = "\ x1B [31m \ u \ x1B [34m @ \ x1B [0 m [\ D]: \ x1B [32mGCE-Node1_www.dwhd.org \ x1B [0 m: \ x1B [31 m (\ d) \ x1B [0 m> "'# set the mysql command to the specified content -- prompt =" \ x1B [31m \ u \ x1B [34m @ \ x1B [0 m [\ D]: \ x1B [32mgce-node.pdf www.dwhd.org \ x1B [0 m: \ x1B [31 m (\ d) \ x1B [0 m> "# as shown in the preceding split, the specified \ u is red, the specified @ is blue, and the specified [\ D] is white, Specify the GCE-Node1_www.dwhd.org to green, specify: white, specify (\ d) to red, specify> to white. # You can find the specific code from Google. I will not elaborate on it here.

 

Thought this would end? Take a look at the following. The execution result is also displayed in color.

 

 

Implementation method:
Root@GCE-Node1_www.dwhd.org ~ # Cd/usr/local/src [root@GCE-Node1_www.dwhd.org/usr/local/src] # git clone https://github.com/garabik/grc.git [root@GCE-Node1_www.dwhd.org/usr/local/src] # cd grc [root@GCE-Node1_www.dwhd.org/usr/local/ src/grc] # bash install. sh [root@GCE-Node1_www.dwhd.org/usr/local/src/grc] # cat> ~ /. Bashrc <-EOF if [-f/usr/local/bin/grc]; then alias ping = "grc -- color = auto ping" alias traceroute = "grc -- color = auto traceroute" alias make = "grc -- color = auto make" alias diff = "grc -- color = auto diff "alias cvs =" grc -- color = auto cvs "alias netstat =" grc -- color = auto netstat "fi EOF cat >> ~ /. My. cnf <-EOF [mysql] pager = grcat ~ /. Grcat EOF cat >> ~ /. Grcat <-EOF # default word color # regexp = [\ w ., \: \-_/] + regexp =. + colours = green-# table borders regexp = [+ \-] + [+ \-] | [|] colours = red-# data in () and ''regexp = \ ([\ w \ d, '] + \) colours = white-# numeric regexp = \ s [\ d \.] + \ s * ($ | (? = \ | )) Colours = yellow-# date regexp = \ d {4}-\ d {2}-\ d {2} colours = cyan-# time regexp = \ d {2 }: \ d {2 }:\ d {2} colours = cyan-# IP regexp = (\ d {1, 3 }\.) {3} \ d {1, 3} (: \ d {1, 5 })? Colours = cyan-# schema regexp = '\ w +' colours = yellow-# email regexp = [\ w \. \-_] + @ [\ w \. \-_] + colours = magenta-# row delimeter when using \ G key regexp = [*] +. + [*] + count = stop colours = white-# column names when using \ G key regexp = ^ \ s * \ w +: colours = white EOF [root@GCE-Node1_www.dwhd.org/usr/local/src/grc] # cd &&. ~ /. Bashrc
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.