mysql prompt的用法詳解
更新時(shí)間:2013年06月13日 08:51:42 作者:
本篇文章是對(duì)mysql中prompt的用法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
prompt命令可以在mysql提示符中顯示當(dāng)前用戶、數(shù)據(jù)庫(kù)、時(shí)間等信息
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
選項(xiàng)說明:
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 chabaoo.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
選項(xiàng)說明:
復(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 chabaoo.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ù)介紹,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-08-08
MySQL中DATE_FORMATE函數(shù)使用時(shí)的注意點(diǎn)
這篇文章主要介紹了MySQL中DATE_FORMATE函數(shù)使用時(shí)的注意點(diǎn),主要是針對(duì)其內(nèi)置的字符集使用時(shí)需要轉(zhuǎn)換而進(jìn)行說明,需要的朋友可以參考下2015-05-05
解析:內(nèi)聯(lián),左外聯(lián),右外聯(lián),全連接,交叉連接的區(qū)別
本篇文章是對(duì)內(nèi)聯(lián),左外聯(lián),右外聯(lián),全連接,交叉連接的區(qū)別進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-07-07
MySQL的執(zhí)行原理之 MySQL的查詢重寫規(guī)則詳解
MySQL 性能調(diào)優(yōu)是一個(gè)復(fù)雜且多維度的過程,下面從數(shù)據(jù)庫(kù)設(shè)計(jì)、查詢優(yōu)化、配置參數(shù)調(diào)整、硬件優(yōu)化幾個(gè)方面為你介紹相關(guān)的調(diào)優(yōu)方法,本文給大家介紹MySQL的執(zhí)行原理之 MySQL的查詢重寫規(guī)則,感興趣的朋友一起看看吧2025-04-04
MYSQL SERVER收縮日志文件實(shí)現(xiàn)方法
這篇文章主要介紹了MYSQL SERVER收縮日志文件實(shí)現(xiàn)方法,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-08-08
MySQL數(shù)據(jù)庫(kù)主從復(fù)制與讀寫分離
大家好,本篇文章主要講的是MySQL數(shù)據(jù)庫(kù)主從復(fù)制與讀寫分離,感興趣的同學(xué)趕快來看一看吧,對(duì)你有幫助的話記得收藏一下,方便下次瀏覽2021-12-12
通過兩種方式增加從庫(kù)——不停止mysql服務(wù)
現(xiàn)在生產(chǎn)環(huán)境MySQL數(shù)據(jù)庫(kù)是一主一從,由于業(yè)務(wù)量訪問不斷增大,故再增加一臺(tái)從庫(kù)。前提是不能影響線上業(yè)務(wù)使用,也就是說不能重啟MySQL服務(wù),為了避免出現(xiàn)其他情況,選擇在網(wǎng)站訪問量低峰期時(shí)間段操作2015-11-11

