2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > mysql防止误操作之prompt命令提示符

mysql防止误操作之prompt命令提示符

时间:2021-03-07 14:24:36

相关推荐

mysql防止误操作之prompt命令提示符

参考官方资料:/doc/refman/5.7/en/mysql-commands.html

设置prompt主要是方便搞清楚生产系统中登录的是哪个库,哪个用户,防止误操作。

常用选项如下,其它选项详见官方文档:

OptionDescription\cA counter that increments for each statement you issue\DThe full current date\dThe default database\hThe server host\mMinutes of the current time\RThe current time, in 24-hour military time (0–23)\sSeconds of the current time\UYour full user_name@host_name account name\uYour user name\_A space\ A space (a space follows the backslash)\'Single quote\"Double quote\\A literal \ backslash character

官方给出了共4种方式去设置:

1).推荐,直接在mysql命令窗口中设置

mysql> prompt \R:\m:\s \U[\d]>如果要取消提示,敲prompt命令即可

2).设置MYSQL_PS1环境变量

shell> export MYSQL_PS1="(\u@\h) [\d]> "

3).启动mysql时,使用–prompt参数

shell> mysql --prompt="(\u@\h) [\d]> "

4).prompt参数写入参数文件,比如/etc/f

[mysql]prompt=(\\u@\\h) [\\d]>\\_

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。