一个 mysql server 上的小技巧

2010-05-23 xiao H Posted in 服务器应用

在my.cnf 的 mysql 端 添加如下设置

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
prompt="(\u:mysql1@linuxbyte.org \R:\m)[\d]: "

会产生如下效果:

root@ubuntu:/home/hew# mysql -u hew -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 320
Server version: 5.1.41-3ubuntu12.1 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
(hew:mysql1@linuxbyte.org 21:12)[(none)]: use linuxbyte  #注意这里
 
Database changed
 
(hew:mysql1@linuxbyte.org 21:13)[linuxbyte]: use linuxsky; #这里
 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
 
(hew:mysql1@linuxbyte.org 21:13)[linuxsky]: #这里

如上所示我们可以在mysql命令行下显示当前的mysql 用户,所在主机,时间和所用的数据库。
这个在关键时刻可以让我们避免很多误操作。





标签:,

还没有评论呢。

我来说两句

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">