(转)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 -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
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> prompt Returning 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 -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选项
使用-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/ ...
随机推荐
- 转 Spring AOP @Before @Around @After 等 advice 的执行顺序
转自:http://blog.csdn.net/rainbow702/article/details/52185827 情况一: 一个方法只被一个Aspect类拦截 正常情况: 异常情况: 情况二 ...
- [转]简介Gulp, Grunt, Bower, 和 Npm 对Visual Studio的支持
本文转自:http://www.cnblogs.com/whitewolf/p/4009199.html [原文发表地址]Introducing Gulp, Grunt, Bower, and npm ...
- Android-有序广播是可以中断的
在之前的博客,Android-广播概念,中介绍了(广播和广播接收者)可以组件与组件之间进行通讯,有两种类型的广播(无序广播 和 有序广播),这篇博客就来讲解有序广播的代码实现: 有序广播:接收者 可以 ...
- rabbitmq 简单应用
1. 启动 rabbitmq-server & 2. 队列重置(清空队列.用户等) rabbitmqctl stop_apprabbitmqctl resetrabbitmqctl stop ...
- [ruby]rubyGem出现ERROR: Could not find a valid gem时的处理方法
场景: 想安装SASS的时候,打开cmd,输入gem install sass的时候却出现了: ERROR: Could not find a valid gem 'sass' (>= 0), ...
- leetcode 字符串转整数(atoi)
实现atoi,将字符串转为整数. 在找到第一个非空字符之前,需要移除掉字符串中的空格字符.如果第一个非空字符是正号或负号,选取该符号,并将其与后面尽可能多的连续的数字组合起来,这部分字符即为整数的值. ...
- c# async 事物
上菜 async await 机制 确实便捷开发 多线程时 如何一致性如何保证呢? public async Task<ActionResult<IEnumerable<stri ...
- sharepoint 版本信息查看
#检查版本:# PowerShell script to display SharePoint products from the registry. Param( # decide on wheth ...
- nova network-vif-plugged 事件分析1
在创建虚机过程中,nova-compute会调用wait_for_instance_event函数(nova/compute/manage.py)进行network-vif-plugged的事件等待, ...
- ADV拍卖
#include <stdio.h> int ren,wuping; int qian[20]; int wu1[20],wu2[20],wu3[20]; int a[20],visit[ ...