這篇文章將為大家詳細(xì)講解有關(guān)MySQL中怎么在提示符中顯示當(dāng)前用戶(hù),文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對(duì)相關(guān)知識(shí)有一定的了解。
prompt命令可以在mysql提示符中顯示當(dāng)前用戶(hù)、數(shù)據(jù)庫(kù)、時(shí)間等信息.
例如:
[root@localhost ~]# 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 13
Server version: 5.7.18-log MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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:11:19>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 11:11:22>
root@localhost:test 11:11:24>
root@localhost:test 11:11:24>
root@localhost:test 11:11:25>
也可以把參數(shù)加到my.cnf里面,需要重啟數(shù)據(jù)庫(kù)生效:
[mysql]
prompt=mysql(\\u@\\h:\\d \\r:\\m:\\s)>
關(guān)于MySQL中怎么在提示符中顯示當(dāng)前用戶(hù)就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到。
名稱(chēng)欄目:MySQL中怎么在提示符中顯示當(dāng)前用戶(hù)-創(chuàng)新互聯(lián)
文章分享:http://chinadenli.net/article44/ddgihe.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站設(shè)計(jì)公司、網(wǎng)站維護(hù)、營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、域名注冊(cè)、響應(yīng)式網(wǎng)站、App設(shè)計(jì)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容