MySQL--prompt modify command line link to MySQL prompt, Shell script example below
#!/bin/bash Case$1 inchCRM) cmd='Mysql-h192.168.1.2-uroot-proot-p3306-dcrm';;*) Echo "database variable does not exist: Only input CRM is supported"Exit0;;EsacShift 1$cmd--prompt="[\[email protected]\h:\p (\d) \r:\m:\s] mysql>"--default-character-set=utf8-a"[email protected]"
On the command line, enter the DB CRM execution effect as follows
Liuzhao ~ $ DB CRMwarning:using a password on the command line interface can is insecure. Welcome to the MySQL Monitor. CommandsEndWith , or \g.your MySQL connection ID is54706839Server Version:5.5.40-36.1-log Percona Server (GPL), Release 36.1, Revision 707Copyright (c)and/, Oracleor its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or Itsaffiliates. Other names trademarks of their respectiveowners. Type ' help; ' or ' \h ' forHelp . Type ' \c ' to clear the current input statement. [Root @192.168.1.2:3306 (CRM) 16:59:15] mysql>
--prompt option list, the options used in the sample script are already marked red
\c |
A counter that increments for each statement you issue |
\D |
Current date |
\d |
Current database |
\h |
Database Host |
\l |
The current delimiter (new in 5.1.12) |
\m |
Current Time (min) |
\n |
A newline character |
\O |
The current month in three-letter format (Jan, Feb, ...) |
\o |
The current month in numeric format |
\P |
am/pm |
\p |
The current TCP/IP port or socket file port number |
\R |
Current time (Hours)(0–23) |
\r |
Current time (Hours)(1–12) |
\S |
Semicolon |
\s |
Current time (seconds) |
\t |
A Tab character |
\U |
Your Full Account user_name @host_name name |
\u |
Database user Name |
\v |
The server version |
\w |
The current day of the week in Three-letter format (Mon, Tue, ...) |
\Y |
The current year, four digits |
\y |
The current year, and the digits |
\_ |
A Space |
\ |
A space (a space follows the backslash) |
\‘ |
Single quote |
\" |
Double Quote |
\\ |
A literal " \ " backslash character |
\x |
x , for any " x " not listed above
|
MySQL--prompt