随着管理mysql服务器越来越多,同样的mysql>的提示符有可能会让你输入错误的命令到错误的数据库,这时候需要巧用mysql的提示符,这 是我的提示符root@localhost(mysql) 08:55:21> 用prompt命令实现(适用于windows和linux环境)

mysql>prompt \u@\h(\d) \r:\m:\s>
\u:连接用户
\h:连接主机
\d:连接数据库
\r:\m:\s:显示当前时间
mysql>prompt \u@\h(\d) \r:\m:\s>
root@localhost(mysql) 08:55:21> status

设置方式=>

<1>mysql -uroot -p --prompt="(\\u@\\h)[\\d] \\r:\\m:\\s>"

<2>mysql> prompt (\u@\h)[\d]\r:\m:\s>

<3>也可以在在my.cnf配置文件里进行配置:

[mysql]/[client]

prompt="(\\u@\\h)[\\d] \\r:\\m:\\s>"

default-character-set=utf8

附:

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   www.2cto.com    
Your full user_name@host_name account name  
   
\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  
\x   
x, for any “x” not listed above

mysql提示符prompt的用法相关推荐

  1. linux开终端失败,Linux:终端提示符 (prompt) 不如期生效原因

    原标题:Linux:终端提示符 (prompt) 不如期生效原因 前言 先来简单介绍下, prompt是什么鬼? 顾名思义就是提示符的意思, 看起来和我们遥远, 但实际上只要是每个接触 shell的童 ...

  2. mysql中change用法,mysql 中alter的用法以及一些步骤

    mysql 中alter的用法以及一些方法 在用到alter的时间,查到了这个文章,就copy下来了,详细进入下面链接: MySQL之alter语句用法总结 1:删除列 ALTER TABLE [表名 ...

  3. mysql中正则表达式的用法_Mysql中正则表达式Regexp常见用法

    Mysql中Regexp常见用法 模糊匹配,包含特定字符串 # 查找content字段中包含"车友俱乐部"的记录 select * from club_content where ...

  4. Mysql 分页语句Limit用法

    1.Mysql的limit用法 在我们使用查询语句的时候,经常要返回前几条或者中间某几行数据,这个时候怎么办呢?不用担心,mysql已经为我们提供了这样一个功能. Sql代码   SELECT * F ...

  5. MYSQL 加密函数的用法

    常见加密函数有md5,hash,password等,mysql应用web一般都是md5,32位的,下面讲将MYSQL 加密函数的用法.1,md5加密用法select md5('admin');2,pa ...

  6. 什么是mysql的游标_MySQL游标概念是什么 MySQL游标概念与用法介绍

    本篇文章小编给大家分享一下MySQL游标概念与用法介绍,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看. 1.游标的概念(Cursor) 一条sql,对应N条资源,取出资源的接 ...

  7. mysql中去重的用法_mysql中去重 distinct 用法

    在使用MySQL时,有时需要查询出某个字段不重复的记录,这时可以使用mysql提供的distinct这个关键字来过滤重复的记录,但是实际中我们往往用distinct来返回不重复字段的条数(count( ...

  8. element弹框的的this.$alert、this.$prompt方法用法

    element弹框的的this.alert.this.alert.this.alert.this.prompt方法用法

  9. mysql中的comment用法

    mysql中的comment用法 在MySQL数据库中,字段或列的注释是用属性comment来添加. 创建新表的脚本中, 可在字段定义脚本中添加comment属性来添加注释. 示例代码如下: crea ...

最新文章

  1. 【祝贺】norains同志在这里开《Windows CE大排档》书友会
  2. python 查看函数调用栈
  3. 计算机未识别网络什么意思,win7 64位系统提示当前连接到未识别的网络怎么办...
  4. Hiernate 笔记
  5. 前端三部曲之Html -- 1(html的基本结构和常见的meta标签的作用)
  6. Dotnet core使用JWT认证授权最佳实践(二)
  7. B. The Cake Is a Lie
  8. UIButton的创建与释放问题
  9. VC 获取Windows所有用户的用户名
  10. xcode12 导入SwiftyJSON
  11. 用大白话讲解Carplay(原创)
  12. 人再囧途之泰囧bd高清版
  13. 使用GitHub制作一个高逼格的在线简历
  14. 王道考研——计算机组成原理(第一章 计算机系统概述)
  15. gdb: warning Can‘t open file /usr/lib/libstdc++.so.6.0.19 during file-backed mapping note processing
  16. android 微信架构,微信App支付技术架构全解析
  17. 吃货必备手册,爱辣条就不能错过的零食地图
  18. mac安装texstudio+mactex(texlive)2022+中文字体
  19. ligh@local-host$ ssh-copy-id -i ~/.ssh/id_rsa.pub root@192.168.0.3
  20. 以下为linux下64位c,64位ntohl()在C?

热门文章

  1. runc容器逃逸漏洞最强后续:应对之策汇总与热点疑问解答
  2. windows_硬盘上设置虚拟内存
  3. Lync与Exchange 2013 UM集成配置
  4. iOS开发系列--网络开发(转)
  5. Android WebView 与 JS 交互
  6. 【C++基础】++i和i++
  7. 在IIS中删除ETag的方法
  8. 装机必备工具(普通家庭版)
  9. 让VisualSVN Server支持匿名访问
  10. Hibernate Tools-代码生成