巧用mysql提示符prompt清晰管理数据库的方法
作者:
随着管理mysql服务器越来越多,同样的mysql>的提示符有可能会让你输入错误的命令到错误的数据库,这时候需要巧用mysql的提示符,这是我的提示符root@localhost(mysql) 08:55:21> 用prompt命令实现(适用于windows和linux环境)
mysql>prompt \u@\h(\d) \r:\m:\s>
\u:连接用户
\h:连接主机
\d:连接数据库
\r:\m:\s:显示当前时间
mysql>prompt \u@\h(\d) \r:\m:\s>
root@localhost(mysql) 08:55:21> status
--------------
mysql Ver 14.14 Distrib 5.1.33, for Win32 (ia32)
Connection id: 2
Current database: mysql
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.1.33-community-log MySQL Community Server (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: gb2312
Db characterset: gb2312
Client characterset: latin1
Conn. characterset: latin1
TCP port: 3306
Uptime: 6 min 6 sec
Threads: 2 Questions: 867 Slow queries: 0 Opens: 129 Flush tables: 1 Open t
ables: 9 Queries per second avg: 2.368
--------------
root@localhost(mysql) 08:55:29>
\u:连接用户
\h:连接主机
\d:连接数据库
\r:\m:\s:显示当前时间
mysql>prompt \u@\h(\d) \r:\m:\s>
root@localhost(mysql) 08:55:21> status
--------------
mysql Ver 14.14 Distrib 5.1.33, for Win32 (ia32)
Connection id: 2
Current database: mysql
Current user: root@localhost
SSL: Not in use
Using delimiter: ;
Server version: 5.1.33-community-log MySQL Community Server (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: gb2312
Db characterset: gb2312
Client characterset: latin1
Conn. characterset: latin1
TCP port: 3306
Uptime: 6 min 6 sec
Threads: 2 Questions: 867 Slow queries: 0 Opens: 129 Flush tables: 1 Open t
ables: 9 Queries per second avg: 2.368
--------------
root@localhost(mysql) 08:55:29>