MySQL登陆后提示符的修改

方法一:mysql命令行修改方式

mysql>prompt \u@night \r:\m:\s->

PROMPT set to '\u@night \r:\m:\s->'

root@night 04:52:47->

root@night 04:53:26->help

For information about MySQL products and services, visit:

http://www.mysql.com/

For developer information, including the MySQL Reference Manual, visit:

http://dev.mysql.com/

To buy MySQL Enterprise support, training, or other products, visit:

https://shop.mysql.com/

List of all MySQL commands:

Note that all text commands must be first on line and end with ';'

?(\?) Synonym for `help'.

clear(\c) Clear the current input statement.

connect(\r) Reconnect to the server. Optional arguments are db and host.

delimiter (\d) Set statement delimiter.

edit(\e) Edit command with $EDITOR.

ego(\G) Send command to mysql server, display result vertically.

exit(\q) Exit mysql. Same as quit.

go(\g) Send command to mysql server.

help(\h) Display this help.

nopager(\n) Disable pager, print to stdout.

notee(\t) Don't write into outfile.

pager(\P) Set PAGER [to_pager]. Print the query results via PAGER.

print(\p) Print current command.

prompt(\R) Change your mysql prompt.修改mysql提示符

quit(\q) Quit mysql.

rehash(\#) Rebuild completion hash.

source(\.) Execute an SQL script file. Takes a file name as an argument.

status(\s) Get status information from the server.

system(\!) Execute a system shell command.

tee(\T) Set outfile [to_outfile]. Append everything into given outfile.

use(\u) Use another database. Takes database name as argument.

charset(\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.

warnings(\W) Show warnings after every statement.

nowarning (\w) Don't show warnings after every statement.

For server side help, type 'help contents'

root@night 04:53:38->

方法二:通过shell命令行修改

[root@localhost data]# mysql -u root -p'www.123' --prompt="\u@\h:\d-->"

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

Your MySQL connection id is 8

Server version: 5.5.27 Source distribution

Copyright (c) 2000, 2011, 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)-->

方法三:配置文件修改方法

[root@localhost data]# tail -2 /etc/my.cnf

[mysql]

prompt=\\u@night\\r:\\m:\\s->

[root@localhost data]#

[root@localhost data]# mysql -uroot -p'www.123'

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

Your MySQL connection id is 9

Server version: 5.5.27 Source distribution

Copyright (c) 2000, 2011, 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@night07:11:51->

提示:不需要重新启动数据库,只需要关闭数据库重新启动就可以了。

注意:在配置文件中要加反斜杠以屏蔽特殊意义。

方法四:通过环境变量修改

[root@localhost data]# tail -1 /etc/profile

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

[root@localhost data]# source /etc/profile

[root@localhost data]# mysql -uroot -p'www.123'

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

Your MySQL connection id is 12

Server version: 5.5.27 Source distribution

Copyright (c) 2000, 2011, 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)]-->

格式解释:

通过man mysql 得到如下内容:

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

 

\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

Your full user_name@host_name account name

 

\u

Your user name

 

\v

The server version

 

\w

The current day of the week inthree-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

 

本文出自 “night ★linux运维” 博客,请务必保留此出处http://night820.blog.51cto.com/7492507/1341672

(转)MySQL登陆后提示符的修改的更多相关文章

  1. prompt更改MySQL登陆后的提示符

    临时生效 mysql> prompt \u@standby \r:\m:\s > PROMPT set to '\u@standby \r:\m:\s >' root@standby ...

  2. 树莓派3b+ Ubuntu 16.04 MATA系统 ssh远程登陆后修改主机名、用户密码和用户名

    写在前面: 刚刚开始写博客,记录下自己的学习过程,备忘. 最近在使用树莓派做智能小车的开发,使用的是树莓派3b+,安装的是Ubuntu 16.04 MATA 系统,安装系统后需要修改主机名,登陆密码以 ...

  3. mysql安装完之后,登陆后发现只有两个数据库

    mysql安装完之后,登陆后发现只有两个数据库:mysql> show databases;+--------------------+| Database           |+------ ...

  4. Centos6.5修改mysql登陆用户密码

    1.修改mysql的登陆设置: vim /etc/my.cnf 并在[mysqld] 下面添加一句:skip-grant-tables=1 添加成功后保存退出. 2.重启mysql并修改密码 重启my ...

  5. linux修改登陆后进入的默认目录

    如将root登陆后进入的路径由/root改为/opt/FriendlyARM/linux/u-boot-mini6410修改/etc/pssswd 修改行 root:x:0:0:root:/root: ...

  6. 修改mysql端口后重启mysql报错:Can't start server: Bind on TCP/IP port. Got error...n denied

    1:错误信息:如下 [root@host ~]# systemctl status mariadb ● mariadb.service - MariaDB database server Loaded ...

  7. 修改了Mysql密码后连接不到服务且无报错信息解决方法以及修改密码方法

    安装MYSQL后更改了root的密码后用 net start mysql 启动时出现:无法启动,无报错信息 使用以下命令:1.管理员方式cmd进入mysql安装目录的bin目录下2.执行命令:mysq ...

  8. mysql 登陆与退出

    Mysql登陆与退出 登陆参数 登陆命令 mysql -uroot -p 回车输入密码 退出有三个命令:  exit  quit  \q 修改mysql提示符 连接mysql客户端时通过参数指定: 登 ...

  9. ubuntu上mysql服务器安装后只能本地连接不能远程连接的问题

    安装好mysql后,想使用另一个电脑进行远程登录,在登录时 提示拒绝连接 百度后,发现需要两个步骤解决该问题 /etc/mysql/my.cnf 里修改bind_address = 0.0.0.0  ...

随机推荐

  1. 2018.07.17 洛谷P1368 工艺(最小表示法)

    传送门 好的一道最小表示法的裸板,感觉跑起来贼快(写博客时评测速度洛谷第二),这里简单讲讲最小表示法的实现. 首先我们将数组复制一遍接到原数组队尾,然后维护左右指针分别表示两个即将进行比较的字符串的头 ...

  2. 2018.07.06 POJ2536 Gopher II(二分图匹配)

    Gopher II Time Limit: 2000MS Memory Limit: 65536K Description The gopher family, having averted the ...

  3. cordova 选择图片并上传到服务器

    js navigator.camera.getPicture(function(imageURI){ var url=apiUrl+"/upload.aspx"; //alert( ...

  4. android 蓝牙通讯编程 备忘

    1.启动App后: 判断->蓝牙是否打开(所有功能必须在打牙打开的情况下才能用) 已打开: 启动代码中的蓝牙通讯Service 未打开: 发布 打开蓝牙意图(系统),根据Activity返回进场 ...

  5. org.hibernate.HibernateException: /hibernate.cfg.xml not found等三个问题

    初次配置hibernate在myeclipse上: 出现三个问题,怎么都不好使,比对代码,没有问题,查看路径还是没有问题: 1.org.hibernate.HibernateException: /h ...

  6. Robotframework 之常用断言关键字简介

    任何自动化测试框架或实例中断言是必不可少的,Robotframework同样如此,那下面就介绍下其常用断言关键字. 1.Should Be Empty   判断是否为空,如果不为空,执行失败,示例: ...

  7. PAT甲 1041. Be Unique (20) 2016-09-09 23:14 33人阅读 评论(0) 收藏

    1041. Be Unique (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Being uniqu ...

  8. hdu2680 choose the best route

    题目 题意:给定一个有向图,多个起点,一个终点,求起点到终点的最短路. 这道题TLE了好多次,两侧次的对比主要在于对起点的处理上,法一:最开始是采用的hdu2066--一个人的旅行,这道题的方法做的, ...

  9. 摘抄-----java codeReview要做的事

    整洁的代码 清单项目 分类 使用可以表达实际意图(Intention-Revealing)的名称 有意义的名称 每一个概念只用一个词 有意义的名称 使用方案/问题领域名称 有意义的名称 类应该是比较小 ...

  10. Redis Sentinel基本介绍(翻译以及总结)

    目录 Redis Sentinel介绍 分布式的Redis Sentinel 快速开始 获取Sentinel 启动Sentinel 部署Sentinel的基本要求 配置Sentinel 其他的Sent ...