The prompt command displays the current user, database, time, and other information at the mysql prompt.
Copy codeThe Code is as follows: mysql-uroot-p -- prompt = "\ u @ \ h: \ d \ r: \ m: \ s>"
After the setting is successful:Copy codeThe Code is as follows: Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 5
Server version: 5.1.60-log Source distribution
Copyright (c) 2000,201 2, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.
Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
Root @ localhost :( none) 11:04:23>
You can also configure it in the my. cnf configuration file:Copy codeThe Code is as follows: [mysql]
Prompt = mysql (\ u @ \ h: \ d)>
Default-character-set = utf8
Option description:Copy codeThe Code is as follows: 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 ,...)
\ O The current month in numeric format
\ P am/pm
\ P The current TCP/IP port or socket file
\ R The current time, in 24-hour military time (0-23)
\ R The current time, standard 12-hour time (1-12)
\ S Semicolon
\ S Seconds of the current time
\ T A tab character
\ U www.2cto.com
Your full user_name @ host_name account name
\ U Your 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, two 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