大家通過mysql客戶端連接到服務器時,管理時,不知道當前在哪個數據庫中。下面通過定義prompt來實現。只要在你的my.cnf的[mysql]加入如下內容:
prompt=\\u@\\d \\r:\\m\\_>
注意:搞清楚你的mysql調用的哪個位置的my.cnf,不要搞錯了。
使用mysql客戶端登錄mysql服務器。默認類似如下:
root@(none) 03:16 >
進入一個db。
root@(none) 03:16 >use testdb;
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@testdb 03:16 >
可以看到,前面是當前賬戶root,@後面是數據庫名稱。是不是很方便。如果想做更多的自定義,百度一下"mysql prompt". 快去玩耍吧。