MySQL Prompt usage detailed _mysql

Source: Internet
Author: User
The prompt command can display information about the current user, database, time, and so on at the MySQL prompt
Copy Code code as follows:

Mysql-uroot-p--prompt= "\\u@\\h:\\d \\r:\\m:\\s>"

After the setting is successful:
Copy Code code 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), the Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark the Oracle Corporation and/or its
Affiliates. Names may 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>

Can also be configured in the MY.CNF configuration file:
Copy Code code as follows:

[MySQL]
Prompt=mysql (\\u@\\h:\\d) >

Default-character-set=utf8

Option Description:
Copy Code code 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 (a few, 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 Standard 12-hour time (1–12)
\s Semicolon
\s Seconds of the current time
\ t A tab character
\u www.jb51.net
Your Full User_name@host_name account name

\u Your User Name
\v the server version
\w 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 all "X" not listed above

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.