首页 / MYSQL / (转)MySQL登陆后提示符的修改
(转)MySQL登陆后提示符的修改
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了(转)MySQL登陆后提示符的修改,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含5055字,纯文字阅读大概需要8分钟。
内容图文
![(转)MySQL登陆后提示符的修改](/upload/InfoBanner/zyjiaocheng/492/1569a33e1bf045d2b6849ea3de1df871.jpg)
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登陆后提示符的修改
标签:soc multi issue pen etc nts stand UI welcome
本文系统来源:http://www.cnblogs.com/liujiacai/p/7577228.html
内容总结
以上是互联网集市为您收集整理的(转)MySQL登陆后提示符的修改全部内容,希望文章能够帮你解决(转)MySQL登陆后提示符的修改所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。