mysql -prompt选项
使用-pormpt修改提示符。可以在登录时或者在登录后使用prompt选项来修改提示符
(1)使用mysql命令行参数修改提示符
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 27
Server version: 5.6.25 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. mysql> # mysql -uroot -p --prompt="\\u@\\h:\\d \\r:\\m:\\s>"
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28
Server version: 5.6.25 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@localhost:(none) 10:05:25>use test
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@localhost:test 10:05:31>
(2)修改配置文件/etc/my.cnf
[mysql]
prompt="\\u@\\h:\\d \\r:\\m:\\s>"
(3)在 MySQL 中使用 prompt 命令
mysql> prompt \r:\m:\s\P>\_
PROMPT set to \'\r:\m:\s\P>\_\'
08:20:42pm> prompt
Returning to default PROMPT of mysql>
mysql>
(4)当然可以在在Bash层修改 MYSQL_PS1变量
# export MYSQL_PS1="(\u@\h) [\d]> "
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 31
Server version: 5.6.25 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@localhost) [(none)]> use test
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@localhost) [test]>
参数辅助说明
Option | Description |
---|---|
\c |
A counter that increments for each statement you issue |
\D |
The full current date |
\d |
The default database |
\h |
The server host |
\l |
The current delimiter (new in 5.1.12) |
\m |
Minutes of the current time |
\n |
A newline character |
\O |
The current month in three-letter format (Jan, Feb, …) |
\o |
The current month in numeric format |
\P |
am/pm |
\p |
The current TCP/IP port or socket file |
\R |
The current time, in 24-hour military time (0–23) |
\r |
The current time, standard 12-hour time (1–12) |
\S |
Semicolon |
\s |
Seconds of the current time |
\t |
A tab character |
\U |
Your full |
\u |
Your user name |
\v |
The server version |
\w |
The current day of the week in three-letter format (Mon, Tue, …) |
\Y |
The current year, four digits |
\y |
The current year, two digits |
\_ |
A space |
\ |
A space (a space follows the backslash) |
\' |
Single quote |
\" |
Double quote |
\\ |
A literal “\ ” backslash character |
\ |
|
mysql -prompt选项的更多相关文章
- (转)mysql -prompt选项
mysql -prompt选项 原文:http://www.cnblogs.com/abclife/p/5632826.html 使用-pormpt修改提示符.可以在登录时或者在登录后使用prompt ...
- mysql --prompt
mysql --prompt修改命令行链接mysql时的提示符,shell脚本示例如下 #!/bin/bash in crm) cmd='mysql -h192.168.1.2 -uroot -pro ...
- [转] mysql --prompt介绍
mysql --prompt修改命令行链接mysql时的提示符,shell脚本示例如下 #!/bin/bash case $1 in crm) cmd='mysql -h192.168.1.2 -ur ...
- mysql prompt的用法详解
prompt命令可以在mysql提示符中显示当前用户.数据库.时间等信息 代码如下: mysql -uroot -p --prompt="\\u@\\h:\\d \\r:\\m:\\s> ...
- MySQL binlog-do-db选项是危险的
很多人通过 binlog-do-db, binlog-ignore-db, replicate-do-db 和 replicate-ignore-db 来过滤复制(某些数据库), 尽管有些使用, ...
- MySQL binlog-do-db选项是危险的[转]
很多人通过 binlog-do-db, binlog-ignore-db, replicate-do-db 和 replicate-ignore-db 来过滤复制(某些数据库), 尽管有些使用, ...
- 监控mysql各种选项
安装mysql之后,需要对mysql服务进行监控. nagios开源自带的check_mysql 对 mysql 的slave 机监控倒是不错.但是对数据库主机监控就略显不足了. 使用一个监控 ...
- MySQL read_only选项的作用
1作用: 从字面意思上看就可以知道这个是把mysql设置为只读,但是这个只读只是针对一般用户而言的,对于root这种用super权限的用户read_only是没有用的. 2设置方式: set glob ...
- MySQL prompt命令
修改提示符,设置后挺方便的 例如: 几个好用的参数 \d 当前数据库 \u 当前用户 \h 当前主机 更多参数可以参考mysol官方文档 参考文档:https://dev.mysql.com/doc/ ...
随机推荐
- 浏览器User-agent String里的历史故事
你是否好奇标识浏览器身份的User-Agent,为什么每个浏览器都有Mozilla字样? Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 ...
- 达内培训:php在线端口扫描器
达内培训:php在线端口扫描器 [来源] 达内 [编辑] 达内 [时间]2012-12-21 这个扫描器很简单.就是用了一个数组来定义端口的相关信息,原理就是用fsockopen函数连接,如 ...
- iOS中利用CoreTelephony获取用户当前网络状态(判断2G,3G,4G)
前言: 在项目开发当中,往往需要利用网络.而用户的网络环境也需要我们开发者去注意,根据不同的网络状态作相应的优化,以提升用户体验. 但通常我们只会判断用户是在WIFI还是移动数据,而实际上,移动数据也 ...
- changing a pointer rather than erasing memory cells
Computer Science An Overview _J. Glenn Brookshear _11th Edition In a data structure based on a point ...
- XML xsd
targetNamespace:表示本XSD中定义的元素和类型的名字空间都是http://exammpleOrder. xmlns:xsd:表示以前缀xsd开头的元素或则类型来自于http://www ...
- mongodb在win7下的安装和使用
1.下载mongodb的windows版本,有32位和64位版本,根据系统情况下载,下载地址:http://www.mongodb.org/downloads 2.解压缩至额E:/mongodb即可 ...
- Simplest way to serve static data from outside the application server in a Java web application
tomcat service.xml <Context docBase="/path/to/images" path="/images" /> re ...
- Photoshop:通过图片理解通道原理
电脑上的图像通过色光三原色RGB表现,不同颜色存储在不同的通道,所以RGB模式下有3条通道,CMYK模式有4条通道等等 打开一张照片,查看通道 可以看出,显示越白的地方,对应的原色越深. 默认phot ...
- 1058 N的阶乘的长度
1058 N的阶乘的长度 基准时间限制:1 秒 空间限制:131072 KB 输入N求N的阶乘的10进制表示的长度.例如6! = 720,长度为3. Input 输入N(1 <= N <= ...
- gulp-less插件之less文件编译成css
gulp 是基于node的,所以第一步要确保你已经安装了node环境,具体怎么安装可以到node官网去看一下(https://nodejs.org/en/) 1.全局按钮gulp 打开node窗口输入 ...