prompt命令可以在mysql提示符中显示当前用户、数据库、时间等信息

代码如下:


mysql -uroot -p --prompt="\\u@\\h:\\d \\r:\\m:\\s>"

设置成功后:

代码如下:


Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 5

Server version: 5.1.60-log Source distribution

Copyright (c) 2000, 2012, 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) 11:04:23>

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

代码如下:


[mysql] 

prompt=mysql(\\u@\\h:\\d)> 



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.jb51.net 

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. MySQL自定义函数用法详解-复合结构自定义变量/流程控制

    自定义函数 (user-defined function UDF)就是用一个象ABS() 或 CONCAT()这样的固有(内建)函数一样作用的新函数去扩展MySQL. 所以UDF是对MySQL功能的一 ...

  2. Mysql中timestamp用法详解

    前言:时间戳(timestamp),一个能表示一份数据在某个特定时间之前已经存在的. 完整的. 可验证的数据,通常是一个字符序列,唯一地标识某一刻的时间.使用数字签名技术产生的数据, 签名的对象包括了 ...

  3. MySQL数据类型DECIMAL用法详解

    MySQL DECIMAL数据类型用于在数据库中存储精确的数值.我们经常将DECIMAL数据类型用于保留准确精确度的列,例如会计系统中的货币数据. 要定义数据类型为DECIMAL的列,请使用以下语法: ...

  4. mysql中event的用法详解

    一.基本概念mysql5.1版本开始引进event概念.event既“时间触发器”,与triggers的事件触发不同,event类似与linux crontab计划任务,用于时间触发.通过单独或调用存 ...

  5. Mysql导入导出工具Mysqldump和Source命令用法详解

    Mysql本身提供了命令行导出工具Mysqldump和Mysql Source导入命令进行SQL数据导入导出工作,通过Mysql命令行导出工具Mysqldump命令能够将Mysql数据导出为文本格式( ...

  6. [转]Mysql导入导出工具Mysqldump和Source命令用法详解

    Mysql本身提供了命令行导出工具Mysqldump和Mysql Source导入命令进行SQL数据导入导出工作,通过Mysql命令行导出工具Mysqldump命令能够将Mysql数据导出为文本格式( ...

  7. Mysql中limit的用法详解

    Mysql中limit的用法详解 在我们使用查询语句的时候,经常要返回前几条或者中间某几行数据,为我们提供了limit这样一个功能. SELECT * FROM table LIMIT [offset ...

  8. mysql配置文件my.cnf详解

    原文地址:mysql配置文件my.cnf详解 作者:gron basedir = path 使用给定目录作为根目录(安装目录). character-sets-dir = path 给出存放着字符集的 ...

  9. CentOS7下Firewall防火墙配置用法详解

    官方文档地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide ...

随机推荐

  1. pid稳态控制

    https://blog.csdn.net/qq_25352981/article/details/81007075

  2. char与varchar的区别

    char的长度是不可变的,而varchar的长度是可变的,也就是说, 定义一个char[10]和varchar[10],如果存进去的是‘csdn’, 那么char所占的长度依然为10, 除了字符‘cs ...

  3. kvm的使用(2)

    一.远程管理kvm虚机 (2)有些情况下,有一个要配置的地方. 因为 KVM(准确说是 Libvirt)默认不接受远程管理,需要按下面的内容配置被管理宿主机中的两个文件: vim /etc/defau ...

  4. python爬虫小实例

    1.python爬取贴吧壁纸 1.1.获取整个页面数据 #coding=utf-8 import urllib def getHtml(url): page = urllib.urlopen(url) ...

  5. 添加 @ResponseBody出现错误的问题

    maven配置: <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>ja ...

  6. 参考:菜菜的sklearn教学之降维算法.pdf!!

    PCA(主成分分析法) 1. PCA(最大化方差定义或者最小化投影误差定义)是一种无监督算法,也就是我们不需要标签也能对数据做降维,这就使得其应用范围更加广泛了.那么PCA的核心思想是什么呢? 例如D ...

  7. Opencv中的WMesh

    费了半天劲,终于把这个WMesh类搞懂了,可惜效果不佳,比Matlab中的mesh差多了. 使用WMesh前,需要有一个Mesh对象,Mesh是三维数据点的基本几何信息.颜色信息.索引信息等集成的对象 ...

  8. jmeter设置中文语言

    1.在jmeter的bin目录下找到  jmeter.properties  文件并打开 2.搜索关键字 “language”,将37行(以搜索到的位置为准)改成下图所示:language=zh_CN ...

  9. Asp.NetCore应用--部署到 ubuntu 进行托管

    准备过程 netcore linux发布包(本人是通过vs2017发布) ubuntu 16.0.4虚机 进行托管 ubuntu  netcore发布文件路径 服务器设置为将对 http://< ...

  10. default.html

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...