Go MySQL post-login prompt modification

Source: Internet
Author: User
Tags mysql commands mysql command line

MySQL changes to the post-login prompt

Method one: MySQL command line modification method

Mysql>prompt \[email protected] \r:\m:\s->

PROMPT set to ' \[email protected] \r:\m:\s-> '

[Email protected] 04:52:47->

[Email protected] 04:53:26->help

For information on MySQL products and services, visit:

http://www.mysql.com/

For developer information, including the MySQL Reference Manual, visit:

http://dev.mysql.com/

To buy MySQL Enterprise support, training, or other products, visit:

https://shop.mysql.com/

List of all MySQL commands:

Note that all text commands must is first on line and end with '; '

? (\?) Synonym for ' help '.

Clear (\c) Clear the current input statement.

Connect (\ r) reconnect to the server. Optional arguments is DB and host.

Delimiter (\d) Set statement delimiter.

Edit command with $EDITOR. \e.

Ego (\g) Send command to MySQL server, display result vertically.

Exit (\q) exit MySQL. Same as quit.

Go (\g) Send command to MySQL server.

Help (\h) Display.

Nopager (\ n) Disable Pager, print to stdout.

Notee (\ t) Don ' t write into outfile.

Pager (\p) Set Pager [To_pager]. Print the query results via PAGER.

Print (\p) print current command.

prompt (\ r) Change your MySQL prompt. Modify MySQL prompt

Quit (\q) quit MySQL.

Rehash (\#) Rebuild completion hash.

Source (\.) Execute an SQL script file. Takes a file name as an argument.

Status (\s) Get status information from the server.

System (\!) Execute a system shell command.

Tee (\ t) Set outfile [To_outfile]. Append everything into given outfile.

Use (\u) use another database. Takes database name as argument.

CharSet (\c) Switch to another charset. Might is needed for processing binlog with Multi-Byte charsets.

Warnings (\w) Show warnings after every statement.

Nowarning (\w) Don ' t show warnings after every statement.

For server side help, type ' help Contents '

[Email protected] 04:53:38->

Method Two: Modify through shell command line

[Email protected] data]# mysql-u root-p ' www.123 '--prompt= "\[email protected]\h:\d-->"

Welcome to the MySQL monitor.commands end with; or \g.

Your MySQL Connection ID is 8

Server version:5.5.27 Source Distribution

Copyright (c), +, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

[Email protected]:(none)--

Method Three: Configuration file modification method

[Email protected] data]# Tail-2/etc/my.cnf

[MySQL]

Prompt=\\[email protected]\\r:\\m:\\s->

[Email protected] data]#

[Email protected] data]# mysql-uroot-p ' www.123 '

Welcome to the MySQL monitor.commands end with; or \g.

Your MySQL Connection ID is 9

Server version:5.5.27 Source Distribution

Copyright (c), +, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

[Email protected]:11:51->

Tip: You do not need to restart the database, just shut down the database to restart.

Note: Add backslashes in the configuration file to mask special meanings.

Method Four: Modify by environment variables

[Email protected] data]# tail-1/etc/profile

Export mysql_ps1= "(\[email protected]\h) [\d]-->"

[Email protected] data]# Source/etc/profile

[Email protected] data]# mysql-uroot-p ' www.123 '

Welcome to the MySQL monitor.commands end with; or \g.

Your MySQL Connection ID is 12

Server version:5.5.27 Source Distribution

Copyright (c), +, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of the Oracle Corporation and/or its

Affiliates. Other names trademarks of their respective

Owners.

Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.

([email protected]) [(None)]-->

Format Explanation:

Get the following from man MySQL:

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

\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

Your full [e-mail Protected]_name account name

\u

Your User Name

\v

The server version

\w

The current day of the Week Inthree-letter format (Mon, Tue, ...)

\y

The current year, four digits

\y

The current year, and the 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

This article is from the "Night★linux" blog, please be sure to keep this source http://night820.blog.51cto.com/7492507/1341672

Go MySQL post-login prompt modification

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.