最近经常需要登录mysql数据库,操作时间一长就不知道自己在那个库里,特别不方便,如果能向Linux登录窗口一样设置就好了!
还好,Mysql中有个prompt可以设置登录环境变量
如下效果:
引用
[root@node2 data]# /opt/app/mysql4/bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.27-hi4

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

root@localhost:mysql.sock[(none)] 11:55:18>use mysql;
Database changed
root@localhost:mysql.sock[mysql] 11:55:27>\q
Bye

实现上面的效果可以编辑my.cnf文件,添加:

[mysql]
prompt=\\U:\\p[\d] \\R:\\m:\\s>


\u:连接用户

\h:连接主机

\d:连接数据库

\r:\m:\s:显示当前时间


参考:http://www.himysql.com/mysql/mysql-prompt-customize.html#more-65
Tags: , ,
数据库配置 | 评论(0) | 引用(0) | 阅读(104)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]