如果已经进入到Mysql环境,办法有两个:


法一:

mysql> status;
--------------
mysql  Ver 14.14 Distrib 5.5.24, for osx10.6 (i386) using readline 5.1
Connection id:      471
Current database:   test
Current user:       root@localhost
SSL:            Not in use
Current pager:      stdout
Using outfile:      ''
Using delimiter:    ;
Server version:     5.5.24 MySQL Community Server (GPL)
Protocol version:   10
Connection:     Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:        /tmp/mysql.sock
Uptime:         6 days 15 min 32 sec
Threads: 2  Questions: 4008  Slow queries: 0  Opens: 189  Flush tables: 1  Open tables: 154  Queries per second avg: 0.007
--------------


法二:

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.24    |
+-----------+
1 row in set (0.06 sec)


如果还未进入工作环境,可以如下:


法一:

localhost-6:~ root$ mysql -V
mysql  Ver 14.14 Distrib 5.5.24, for osx10.6 (i386) using readline 5.1


法二:

localhost-6:~ root$ mysql --help
mysql  Ver 14.14 Distrib 5.5.24, for osx10.6 (i386) using readline 5.1
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.