A good command for mysql prompt

Source: Internet
Author: User

Mysql prompt is a very useful command. You may be very worried about the database you are operating on when you operate mysql through the command line. At least I have struggled with it, maybe you will say that I don't know if I just run a command. Yes, this is indeed acceptable. But today I will introduce you to a useful command-prompt [html] [root @ fsailing1 ~] # Mysql-uroot-p -- prompt = "\ u @ \ h: \ d \ r: \ m: \ s>" Enter password: welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 378 www.2cto.com Server version: 5.0.95 Source distribution Copyright (c) 2000,201 1, 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) 08:23:32> use test;
Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with-A Database changed root @ localhost: test 08:23:44> exit;
The advantage of doing so is to make it easier and faster for all of us to operate databases.
You can also configure it in the my. cnf configuration file:
[Html] [mysql] prompt = mysql (\ u @ \ h: \ d)> default-character-set = utf8 [html] [root @ fsailing1 ~] # Vim/etc/my. cnf [root @ fsailing1 ~] # Service mysqld restart stop MySQL: [OK] Start MySQL: [OK] [root @ fsailing1 ~] # Mysql-uroot-p Enter password: Welcome to the MySQL monitor. commands end with; or \ g. your MySQL connection id is 2 www.2cto.com Server version: 5.0.95 Source distribution Copyright (c) 2000,201 1, 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. mysql (root @ localhost :( none)> use test; reading table information for completion of table and column names You can turn off this feature to get a quicker startup with-A Database changed mysql (root @ localhost: test)>
Some options are also provided for your reference.
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 (M On, 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, for any" x "not listed abve author chen861201

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.