如何在MySQL提示符中顯示當前使用者、資料庫、時間等資訊
prompt命令可以在mysql提示符中顯示當前使用者、資料庫、時間等資訊.
例如:
[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>
也可以把引數加到my.cnf裡面,需要重啟資料庫生效:
[mysql]
prompt=mysql(\\u@\\h:\\d \\r:\\m:\\s)>
例如:
[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>
也可以把引數加到my.cnf裡面,需要重啟資料庫生效:
[mysql]
prompt=mysql(\\u@\\h:\\d \\r:\\m:\\s)>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15498/viewspace-2140383/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- javaScript動態顯示當前時間JavaScript
- android 顯示當前時間(EEEE)顯示星期幾Android
- Qt學習(5)獲取當前系統時間-實時顯示當前時間QT
- qt中實現實時的顯示當前時刻的時間QT
- shell 命令提示符中顯示時間(qbit)
- Qt QDate QTime顯示當前系統時間QT
- PLSQL實現顯示當天是星期幾及當前時間SQL
- MySQL檢視當前資料庫庫MySql資料庫
- QT顯示當前日期時間QT
- 檢視當前Oracle資料庫的時間及其SCN號Oracle資料庫
- oracle 當前資料庫各種版本時間釋出表Oracle資料庫
- 如何在linux console中顯示當前你在的branch?Linux
- 修改環境變數顯示當前登陸使用者的相關資訊變數
- 檢視當前使用者執行語句等資訊
- 查詢當前資料庫名、使用者名稱、資料庫伺服器IP、埠、資料庫版本資訊。資料庫伺服器
- oracle 中如何顯示sql語句的執行時間和sql語句的執行後的當前時間OracleSQL
- 更改當前資料庫預設臨時表空間注意事項資料庫
- mongodb中如何設定當前時間?MongoDB
- 如何在請求資料時,顯示載入動畫動畫
- 刪除當前資料庫連線使用者資料庫
- 商城專案解析(如果通過輸入商品分類顯示商品規格引數,在使用者輸入完商品資訊後,又如何把對應的資料Spu,Sku,庫存Stock,建立時間,最後一次更新時間等輸入到資料庫當中)資料庫
- 將MYSQL資料顯示在QT的tablewidget中/將QT中的資料儲存到MYSQL資料庫中MySqlQT資料庫
- MySQL顯示連線的資料庫名MySql資料庫
- 【指令碼】快速獲得當前使用者下“暫忘”的資料庫物件資訊指令碼資料庫物件
- MySQL實現當前資料表的所有時間都增加或減少指定的時間間隔(推薦)MySql
- Qt中利用定時器QTimer實時顯示當前日期和時間QT定時器
- 查詢時間從前7天到當前時間
- mysql中取系統當前時間,當前日期方便查詢判定的程式碼MySql
- Qt中利用定時器QTimer準實時顯示當前日期和時間QT定時器
- mysql資料庫時間戳函式MySql資料庫時間戳函式
- 使用當前使用者的資料庫鏈的實現資料庫
- Qt 時間顯示QT
- asp.net 中實時顯示本地時間ASP.NET
- c++ 獲取當前時間周初凌晨時間戳(獲取當前時間週一凌晨時間戳)C++時間戳
- mybatis獲取當前時間MyBatis
- java獲取當前時間Java
- Qt獲取當前時間QT
- js獲取當前時間JS