mysql prompt的用法詳解
更新時間:2013年06月13日 08:51:42 作者:
本篇文章是對mysql中prompt的用法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
prompt命令可以在mysql提示符中顯示當(dāng)前用戶、數(shù)據(jù)庫、時間等信息
mysql -uroot -p --prompt="\\u@\\h:\\d \\r:\\m:\\s>"
設(shè)置成功后:
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, 2012, 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>
也可以在在my.cnf配置文件里進(jìn)行配置:
[mysql]
prompt=mysql(\\u@\\h:\\d)>
default-character-set=utf8
選項說明:
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.dbjr.com.cn
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
復(fù)制代碼 代碼如下:
mysql -uroot -p --prompt="\\u@\\h:\\d \\r:\\m:\\s>"
設(shè)置成功后:
復(fù)制代碼 代碼如下:
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, 2012, 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>
也可以在在my.cnf配置文件里進(jìn)行配置:
復(fù)制代碼 代碼如下:
[mysql]
prompt=mysql(\\u@\\h:\\d)>
default-character-set=utf8
選項說明:
復(fù)制代碼 代碼如下:
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.dbjr.com.cn
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
相關(guān)文章
MySQL中LAG()函數(shù)和LEAD()函數(shù)的使用
這篇文章主要介紹了MySQL中LAG()函數(shù)和LEAD()函數(shù)的使用,包括窗口函數(shù)的基本用法,LAG()和LEAD()函數(shù)介紹,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-08-08
MySQL中DATE_FORMATE函數(shù)使用時的注意點
這篇文章主要介紹了MySQL中DATE_FORMATE函數(shù)使用時的注意點,主要是針對其內(nèi)置的字符集使用時需要轉(zhuǎn)換而進(jìn)行說明,需要的朋友可以參考下2015-05-05
解析:內(nèi)聯(lián),左外聯(lián),右外聯(lián),全連接,交叉連接的區(qū)別
本篇文章是對內(nèi)聯(lián),左外聯(lián),右外聯(lián),全連接,交叉連接的區(qū)別進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-07-07
MySQL的執(zhí)行原理之 MySQL的查詢重寫規(guī)則詳解
MySQL 性能調(diào)優(yōu)是一個復(fù)雜且多維度的過程,下面從數(shù)據(jù)庫設(shè)計、查詢優(yōu)化、配置參數(shù)調(diào)整、硬件優(yōu)化幾個方面為你介紹相關(guān)的調(diào)優(yōu)方法,本文給大家介紹MySQL的執(zhí)行原理之 MySQL的查詢重寫規(guī)則,感興趣的朋友一起看看吧2025-04-04
MySQL數(shù)據(jù)庫主從復(fù)制與讀寫分離
大家好,本篇文章主要講的是MySQL數(shù)據(jù)庫主從復(fù)制與讀寫分離,感興趣的同學(xué)趕快來看一看吧,對你有幫助的話記得收藏一下,方便下次瀏覽2021-12-12

