MySQL显示连接的数据库名
发表于:2025-11-08 作者:千家信息网编辑
千家信息网最后更新 2025年11月08日,在默认下,MySQL在use databasename的时候,是不显示连接的库名!mysql> show databases;+--------------------+| Database |+--
千家信息网最后更新 2025年11月08日MySQL显示连接的数据库名在默认下,MySQL在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>
可通过以下方式,实现显示连接的数据库名:
[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) >
如果想显示连接的库名和时间:
[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 >
也可以添加在my.cnf配置文件中,但是需要重启DB,生产库的话,可不是随便能重启,因此在连接的时候加上即可!
[mysql]
default-character-set = utf8
prompt = \\u(\\d) \\R:\\m:\\s > \
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>
可通过以下方式,实现显示连接的数据库名:
[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) >
如果想显示连接的库名和时间:
[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 >
也可以添加在my.cnf配置文件中,但是需要重启DB,生产库的话,可不是随便能重启,因此在连接的时候加上即可!
[mysql]
default-character-set = utf8
prompt = \\u(\\d) \\R:\\m:\\s > \
时候
数据
数据库
可不
可不是
文件
方式
时间
可通
生产
配置
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
江阴asus服务器维修服务站
用sql建立数据库
中国股市网络安全板块
和平区网络安全培训视频
魔兽世界服务器怎么分
计算机网络技术学啥呀
金融行业的软件开发公司
现货数据软件开发
网络安全成熟度评估
2020年网络安全周视频
开明网络技术
网络安全 被动防御
以色列国家网络安全局
我的世界马桶的服务器地址
MEMORIA下载软件开发
满天星连接服务器
网络技术对农村的影响
杨浦区市场软件开发服务介绍
皇家战争部落服务器
简述网络安全性指标是哪3个
当今网络技术对你产生的影响
企业网络安全工作建议
软件开发工程师评级
12306数据库结构猜想
网络安全班会主题图片
软件开发亿玛酷专注4
数据库中删除表中的非空约束
朝阳行业专业软件开发
北京市公安局网络安全总队号码
张家港提供网络技术咨询热线