mysql prompt的用法详解

时间:2024-01-28 07:30:32 

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
0
投稿

猜你喜欢

  • 几个javascript显示加载进度条代码

    2008-01-19 10:52:00
  • JavaScript实现省市县三级级联特效

    2024-04-18 10:55:56
  • Python PIL读取的图像发生自动旋转的实现方法

    2022-05-01 20:29:26
  • SQL Server DBA日常检查常用SQL

    2024-01-12 21:47:49
  • SESSION存放在数据库用法实例

    2024-05-11 10:09:56
  • Python基于Django实现验证码登录功能

    2023-06-25 03:21:13
  • MySQL执行时间的查询

    2024-01-14 13:54:25
  • Python unittest模块用法实例分析

    2023-03-28 17:36:06
  • taro小程序添加骨架屏的实现代码

    2024-04-19 11:04:04
  • Python实现自动化处理Word文档的方法详解

    2022-05-24 00:33:59
  • 如何建设一个多语言版的ASP网站?

    2009-11-26 20:36:00
  • tf.nn.conv2d与tf.layers.conv2d的区别及说明

    2021-03-29 13:36:53
  • ThinkPHP中url隐藏入口文件后接收alipay传值的方法

    2024-05-03 15:50:25
  • 在ASP中用FormatDateTime格式化日期

    2010-08-08 19:16:00
  • MySQL查询缓存的小知识

    2024-01-22 20:55:29
  • z-blog文章摘要图文混排

    2009-02-28 13:49:00
  • SqlServer使用公用表表达式(CTE)实现无限级树形构建

    2024-01-22 00:34:09
  • python numpy实现文件存取的示例代码

    2022-01-11 07:14:58
  • jquery 使用点滴函数代码

    2011-05-21 16:12:00
  • Python下载ts文件视频且合并的操作方法

    2021-11-15 15:40:19
  • asp之家 网络编程 m.aspxhome.com