Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL displays the database name of the connection

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

By default, when MySQL is in use databasename, the library name of the connection is not displayed!

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 >

You can display the database name of the connection in the following ways:

[root@hank-yoon 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) 2000, 2015, 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 ((none)) > use yoon

Database changed

Root (yoon) >

To display the library name and time of the connection:

[root@hank-yoon 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) 2000, 2015, 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 ((none)) 15:20:08 > use yoon

Database changed

Root (yoon) 15:20:16 >

It can also be added to the my.cnf configuration file, but you need to restart DB, so you can't just restart the production library, so add it when you connect!

[mysql]

Default-character-set = utf8

Prompt =\ u (\ d)\ R:\ m:\ s >\

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report