mysql --prompt
mysql --prompt修改命令行链接mysql时的提示符,shell脚本示例如下
#!/bin/bash case $ in
crm) cmd='mysql -h192.168.1.2 -uroot -proot -P3306 -Dcrm'
;;
*)
echo "数据库变量不存在:$1 仅支持输入 crm"
exit
;;
esac
shift
$cmd --prompt="[\u@\h:\p(\d) \R:\m:\s] mysql>" --default-character-set=utf8 -A "$@"
在命令行输入 db crm 执行效果如下
liuzhao ~ $ db crm
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 54706839
Server version: 5.5.40-36.1-log Percona Server (GPL), Release 36.1, Revision 707 Copyright (c) 2000, 2014, 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@192.168.1.2:3306(crm) 16:59:15] mysql>
--prompt选项列表,示例脚本中用到的选项已经标红
\c |
A counter that increments for each statement you issue |
\D |
当前日期 |
\d |
当前数据库 |
\h |
数据库主机 |
\l |
The current delimiter (new in 5.1.12) |
\m |
当前时间(分) |
\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 |
当前时间(小时)(0–23) |
\r |
当前时间(小时)(1–12) |
\S |
Semicolon |
\s |
当前时间(秒) |
\t |
A tab character |
\U |
Your full |
\u |
数据库用户名 |
\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 case $1 in crm) cmd='mysql -h192.168.1.2 -ur ...
- (转)mysql -prompt选项
mysql -prompt选项 原文:http://www.cnblogs.com/abclife/p/5632826.html 使用-pormpt修改提示符.可以在登录时或者在登录后使用prompt ...
- mysql prompt的用法详解
prompt命令可以在mysql提示符中显示当前用户.数据库.时间等信息 代码如下: mysql -uroot -p --prompt="\\u@\\h:\\d \\r:\\m:\\s> ...
- MySQL prompt命令
修改提示符,设置后挺方便的 例如: 几个好用的参数 \d 当前数据库 \u 当前用户 \h 当前主机 更多参数可以参考mysol官方文档 参考文档:https://dev.mysql.com/doc/ ...
- MySQL prompt提示符总结
A counter that increments for each statement you issue \D 当前日期 \d 当前数据库 \h 数据库主机 \l The current de ...
- prompt更改MySQL登陆后的提示符
临时生效 mysql> prompt \u@standby \r:\m:\s > PROMPT set to '\u@standby \r:\m:\s >' root@standby ...
- MySQL的prompt不生效的问题
安装完MySQL之后,使用了自定义的配置文件来启动MySQL,发现配置在[mysql]中的prompt并没有生效 [root@MySQL56_L1 ~]# /usr/local/mysql/bin/m ...
- MySQL碎碎念
1. 如何修改Mysql的用户密码 mysql> update mysql.user set password=password('hello') where user='root'; mysq ...
随机推荐
- 移动端前端笔记 — 遇到的常见JS与CSS问题及解决方法 ( 摘自zdwzdwzdw)
笔者接触移动前端快一年了,特将平时的一些笔记整理出来,希望能够给需要的人一些小小的帮助.同时也由于笔者的水平有限,虽说都是笔者遇到过使用过的,但文中可能也会出现一些问题或不严谨的地方,望各位指出,不胜 ...
- ADO.net操作数据库
今天整理硬盘,发现2年前开始着手开始学习C#的学习日记.陆续整理,一是自己的知识梳理梳理,二是希望与大家多多交流,能给初学者带来一定帮助,当然是更高兴的啦. 断线对象 另一类是与数据源无关的断线对象, ...
- C语言题库的上机题
1.编写函数,实现从键盘上输入一个小写字母,将其转化为大写字母. #include<stdio.h> int zhuanhua(char s); void main(){ char s; ...
- python中文编码
前面章节中我们已经学会了如何用 Python 输出 "Hello, World!",英文没有问题,但是如果你输出中文字符"你好,世界"就有可能会碰到中文编码问题 ...
- 今天我们要说的画一个三角形,恩,画一个三角形,第一种呢是利用我们的html标签结合css来实现;而第二种方法就就是我们的html5新增的一个标签canves,这个canves就是网页画幕,那么顾名思义就是在网页里建造一个画板,用来画画,好,那接下来就和我一起去看看吧!
第一种方法:利用我们的html标签结合css来实现 span{ width:0px; height:0px; border-width:7px; border-style:solid; border- ...
- 【转】Linux中xargs的用法
xargs大 多数 Linux 命令都会产生输出:文件列表.字符串列表等.但如果要使用其他某个命令并将前一个命令的输出作为参数该怎么办?例如,file 命令显示文件类型(可执行文件.ascii 文本等 ...
- Python基于pandas的数据处理(二)
14 抽样 df.sample(10, replace = True) df.sample(3) df.sample(frac = 0.5) # 按比例抽样 df.sample(frac = 10, ...
- IOS XIB Cell自适应高度实现
1.代码实现Cell高度自适应的方法 通过代码来实现,需要计算每个控件的高度,之后获取一个cell的 总高度,比较常见的是通过lable的文本计算需要的高度. CGSize labelsize = [ ...
- Texture2D.GetPixelBilinear(float u, float v)的使用,官方例子注释
using UnityEngine; using System.Collections; public class TEST : MonoBehaviour { public Texture2D so ...
- 1.webService入门
学习webService前,先来思考一个问题: 请看以下截图: 以上是一个综合网站的部分显示信息,我们能很明显的看出打开该网页所处区域的一些信息,比如:地点是厦门,天气是阵雨,温度是9摄氏度等等... ...