這篇文章將為大家詳細(xì)講解有關(guān)MySQL中怎么在提示符中顯示當(dāng)前用戶,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對(duì)相關(guān)知識(shí)有一定的了解。
潞州網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián)建站,潞州網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為潞州成百上千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站制作要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的潞州做網(wǎng)站的公司定做!
prompt命令可以在mysql提示符中顯示當(dāng)前用戶、數(shù)據(jù)庫、時(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ù)庫生效:
[mysql]
prompt=mysql(\\u@\\h:\\d \\r:\\m:\\s)>
關(guān)于MySQL中怎么在提示符中顯示當(dāng)前用戶就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。