Mysql console program prompt string set bitsCN. comThe prompt command reconfigures the default mysql> prompt. The string for defining the prompt can contain the following special sequences.
The default prompt for the mysql console program is "mysql>". the prompt can be modified as needed:
You can set these parameters as follows:
Set the shell environment variable: MYSQL_PS1
Shell> export MYSQL_PS1 = "(/u @/h) [/d]>"
Run the program startup command option: -- prompt
Shell> mysql -- prompt = "(/u @/h) [/d]>"
(User @ host) [database]>
Set the [mysql] section in the option file and add the prompt option
[Mysql]
Prompt = (// u @ // h) [// d]> //_
Use the prompt (/R) command in the mysql program
Mysql> prompt (/u @/h) [/d]> /_
PROMPT set to '(/u @/h) [/d]> /_'
(User @ host) [database]>
(User @ host) [database]> prompt
Returning to default PROMPT of mysql>
Mysql>
Some special escape strings in prompt
| Option |
Description |
/c |
A counter that increments for each statement you issue |
/D |
The full current date |
/d |
The default database |
/h |
The server host |
/l |
The current delimiter (new in 5.1.12) |
/m |
Minutes of the current time |
/n |
A newline character |
/O |
The current month in three-letter format (Jan, Feb ,...) |