Usage of mysql prompt

Source: Internet
Author: User

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.jb51.net
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

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.