最近经常需要登录mysql数据库,操作时间一长就不知道自己在那个库里,特别不方便,如果能向Linux登录窗口一样设置就好了!
还好,Mysql中有个prompt可以设置登录环境变量
如下效果:
实现上面的效果可以编辑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
还好,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
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
apache-mod_layout的使用 [原创]
linux sort 使用


2010/07/07 13:09 | by
