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 > \
转载于:https://www.cnblogs.com/hankyoon/p/5169815.html
MySQL显示连接的数据库名相关推荐
- 应用通过MySQL Router连接MGR数据库失败原因-1
MySQL Router是一个轻量级的连接转发代理,用来将应用程序的连接转发到MySQL数据库.Oracle官方建议MySQL Router与应用部署在相同服务器上,当底层MySQL高可用集群(通常是 ...
- 数据库mysql自然连接_MySQL数据库之多表查询natural join自然连接
自然连接 概念 自动判断条件连接,判断的条件是依据同名字段 小结 表连接是通过同名字段来连接的 如果没有同名字段就返回笛卡尔积 同名的连接字段只显示一个,并且将该字段放在最前面 自然内连接(natur ...
- mysql远程连接oracle数据库服务器配置_远程访问oracle数据库
Remote access to the oracle database 首先我们在linux下安装的Oracle软件,并创建了数据库,配置了监听 服务器端: 需要开启监听(lsnrctl start ...
- php mysql sqlite3_PHP连接SQLite数据库
1.创建数据库<?php class SQLiteDB extends SQLite3 { function __construct() { $this->open('phpdb.db') ...
- php mysql oracle_php连接Oracle数据库
要想用php连接Oracle,需要: 1.安装并配置Oracle instant Client 2.配置php的php_oci8_11g拓展 一.Window (一)安装Oracle instant ...
- mysql 新建和删除数据库名有中横线
1.新建数据库时使用,添加反引号(esc下面的那个符号) 2.删除该类数据库也是同理
- navicat for mysql 怎么连接远程数据库服务器
http://zhidao.baidu.com/link?url=eXHM9gJ0-QLqQtzv6gWhuAjYeIptS2z_mRGMRoi6T7wQ6gLGDgy4sn3vQIJLQ1JRUGo ...
- Mysql SQLyog连接远程数据库
- python3连接mysql,python3连接MySQL数据库实例详解
本文实例为大家分享了python3连接MySQL数据库的具体代码,供大家参考,具体内容如下 #python3连接MySQL实例 import pymysql """导入连 ...
- python通过ssh通道连接PostgreSQL数据库(mysql等类同)
目录 一.问题需求 二.解决办法 一.问题需求 对于有ssh通道设置的数据库连接,遇到已经有一段时间了.之前老是疑惑,使用Navicat之类的工具就可以连接数据库,但用python就是连接不到.之前写 ...
最新文章
- 投资83亿!“双一流”高校异地落户,传来新消息!
- Java中return结束循环,Java中break、continue、return在for循环中的使用
- 股权分配中的三种定时炸弹
- 设计模式-装饰者模式[Decorator]
- mysql安全补丁如何处理_3分钟学会mysql数据库的逻辑架构原理
- python gdb coredump_Linux段错误及GDB Coredump调试方法
- 【Ajax】创建并封装
- x264 struct学习 1
- 精选30个优秀的CSS技术和实例
- awbeci—一个帮助你快速处理日常工作的网址收集网站
- Lecture 7:策略梯度
- JavaScript怎么安装_WebStrom 2019安装教程
- Git 打补丁-- patch 和 diff 的使用(详细)
- Redis压力测试(详细)
- QT与LINUXC后台网络通信实现飞机票网络购票
- WORD文档未保存就关闭的解决方法
- Mac谷歌浏览器关闭自动更新,下载历史版本方法,解决不自动提示保存密码的问题
- Navicat注释乱码
- shader里的uv是什么
- 关于pyecharts可视化中国经济、人口等数据