By default, MySQL does not display the connected library name when use DatabaseName!
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| Information_schema |
| Hank |
| MySQL |
| Performance_schema |
| Sakila |
| Test |
| Yoon |
+--------------------+
7 Rows in Set (0.00 sec)
Mysql> Use Yoon;
Database changed
Mysql>
The database name that displays the connection can be implemented in the following ways:
[Email protected] tmp]#MySQL--prompt= "\u (\d) >"
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 29
Server Version:5.6.26-log Source Distribution
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Root ((none)) >use Yoon;
Database changed
Root (Yoon) >
If you want to display the name and time of the connected library:
[Email protected] tmp]#MySQL--prompt= "\u (\d) \r:\m:\s >"
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 30
Server Version:5.6.26-log Source Distribution
Copyright (c), Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Root ((none)) 15:20:08 >use Yoon
Database changed
Root (yoon) 15:20:16 >
can also be added in the my.cnf configuration file, but need to restart the DB, production library, it is not easy to restart, so when connected to add it!
[MySQL]
Default-character-set = UTF8
prompt = \\u (\\d) \\r:\\m:\\s > \
MySQL Displays the database name of the connection