(转)mysql -prompt选项
mysql -prompt选项
原文:http://www.cnblogs.com/abclife/p/5632826.html
使用-pormpt修改提示符。可以在登录时或者在登录后使用prompt选项来修改提示符
(1)使用mysql命令行参数修改提示符
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 27Server version: 5.6.25 Source distributionCopyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.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 28Server version: 5.6.25 Source distributionCopyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.#切换数据库root@localhost:(none) 10:05:25>use testReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedroot@localhost:test 10:05:31> |
(2)修改配置文件/etc/my.cnf
|
1
2
|
[mysql]prompt="\\u@\\h:\\d \\r:\\m:\\s>" |
(3)在 MySQL 中使用 prompt 命令
|
1
2
3
4
5
|
mysql> prompt \r:\m:\s\P>\_PROMPT set to \'\r:\m:\s\P>\_\'08:20:42pm> promptReturning to default PROMPT of mysql>mysql> |
(4)当然可以在在Bash层修改 MYSQL_PS1变量
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# export MYSQL_PS1="(\u@\h) [\d]> "# mysql -u root -pEnter password:Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 31Server version: 5.6.25 Source distributionCopyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.(root@localhost) [(none)]> use testReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase 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选项
使用-pormpt修改提示符.可以在登录时或者在登录后使用prompt选项来修改提示符 (1)使用mysql命令行参数修改提示符 # mysql -u root -p Enter password: ...
- 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/ ...
随机推荐
- python二叉树染色-有严重BUG
#coding:utf-8 ''' 二叉树涂黑 输入: 5 2 1 -1 4 2 -1 5 4 -1 3 1 1 2 输出: 3 第二题是:斗地主 ''' import sys b=list() cl ...
- NAOQI API之学习笔记
https://www.jianshu.com/p/e84f38e45bf5 NAOQI OS是软银pepper和nao机器人的核心操作系统,NAOQI API提供了访问机器人的各种传感器设备接口以及 ...
- JAVA常见面试题及解答
JAVA相关基础知识1.面向对象的特征有哪些方面 1.抽象:抽象就是忽略一个主题中与当前目标无关的那些方面,以便更充分地注意与当前目标有关的方面.抽象并不打算了解全部问题,而只是选择其中的一部分,暂时 ...
- PHP 实现简单搜索功能
方案:问答搜索 1. 搜索结果列表,高亮显示搜索关键词内容 2. 用户输入内容,点击搜索 2.1 获取用户的搜索内容: 2.2 调用分词服务,获取对搜索内容的分词: ...
- EBS单实例上所有正在运行的并发请求以及请求目前的状态
--EBS单实例上所有正在运行的并发请求以及请求目前的状态---一个实例上运行的所有并发请求的总结和他们目前的状态以及等待状态 select w.seconds_in_wait "Se ...
- TSQL--NULL值和三值逻辑
在SQL SERVER 中逻辑表达式存在三种值:TRUE+FALSE+UNKNOWN.UNKNOW可以理解为不确定,既不是TRUE又不是FALSE的表达式,主要由与NULL相关的逻辑判断引起,值为NU ...
- Android / iOS 招聘
1. 面试题 https://github.com/ChenYilong/iOSInterviewQuestions 2. 一些不错的idea CDI - Développeur iOS/Androi ...
- docker 配置 overlay 存储
1.查看overlay模块是否安装 lsmod | grep over 2.将OverlayFS加到module目录下 echo "overlay" > /etc/modul ...
- GO学习笔记 - 没有参数的 return 语句返回各个返回变量的当前值,这种用法被称作“裸”返回。
Go 的返回值可以被命名,并且就像在函数体开头声明的变量那样使用. 返回值的名称应当具有一定的意义,可以作为文档使用. 没有参数的 return 语句返回各个返回变量的当前值.这种用法被称作“裸”返回 ...
- mysql 判断表字段或索引是否存在 - 举一反三
判断字段是否存在: DROP PROCEDURE IF EXISTS schema_change; DELIMITER // CREATE PROCEDURE schema_change() BEGI ...