天天看點

檢視mysql資料庫的版本方法

檢視mysql資料庫的版本方法

當你接手某個mysql資料庫管理時,首先你需要檢視維護的mysql資料庫版本;當開發人員問你mysql資料庫版本時,而恰好你又遺忘了,那麼此時也需要去檢視mysql資料庫的版本..............。下文總結一下linux平台下檢視mysql資料庫的方法.個人覺得總結的比較全面了。

方法1:登入資料庫時,你可以看到對應mysql資料庫的版本資訊,如下所示:

[root@db-server ~]# mysql -u root -penter password: welcome to the mysql monitor. commands end with ; or\g.your

mysql connection id is 3server version: 5.6.19 mysql community server (gpl) copyright (c) 2000, 2014, oracle and/or its

affiliates. all rights reserved. oracle is a registered trademark of oracle

corporation and/or itsaffiliates. other names may be trademarks of their

respectiveowners. type 'help;' or'\h' for help.

type '\c' to clear the current input statement. mysql>

檢視mysql資料庫的版本方法

方法二:使用系統函數檢視mysql資料庫版本。

<a target="_blank" href="http://images.cnitblog.com/blog/73542/201407/241752057132319.png"></a>

mysql&gt; select version();+-----------+| version() |+-----------+| 5.6.19 |+-----------+1 row in set (0.00

sec)  mysql&gt; select @@version;+-----------+| @@version |+-----------+| 5.6.19 |+-----------+1 row in set(0.00

sec) mysql&gt;

檢視mysql資料庫的版本方法

方法3:使用status指令檢視,如下所示,檢視server version後内容。

mysql&gt; status--------------mysql ver 14.14 distrib 5.6.19, for linux (x86_64) using editline wrapper connection id:

3current database:current user:

root@localhostssl: not in usecurrent pager:

stdoutusing outfile: ''using delimiter: ;server version: 5.6.19

mysql community server (gpl)protocol version: 10connection: localhost via unix socketserver characterset: latin1db characterset: latin1client characterset: utf8conn. characterset: utf8unix socket:

/var/lib/mysql/mysql.sockuptime: 2 hours 33 min 14 sec threads: 1 questions: 22 slow queries: 0 opens: 67 flush tables: 1 open tables:

60 queries per secondavg: 0.002--------------

檢視mysql資料庫的版本方法

方法4:使用mysql -v指令檢視

[root@db-server ~]# mysql -v

mysql ver 14.14 distrib 5.6.19, for linux (x86_64) using editline wrapper

[root@db-server ~]# mysql --version

方法5:在mysql --help指令内容中查找

[root@db-server ~]# mysql --help | grep distrib

方法6:通過rpm指令檢視安裝包得知mysql資料庫版本

[root@db-server ~]# rpm -qa | grep -i mysql

mysql-client-5.6.19-1.rhel5

mysql-server-5.6.19-1.rhel5

[root@db-server ~]#

方法7:show variables 指令檢視

mysql&gt; show variables like "%version%";+-------------------------+------------------------------+| variable_name | value |+-------------------------+------------------------------+|

innodb_version | 5.6.19 || protocol_version | 10 || slave_type_conversions | || version | 5.6.19 || version_comment | mysql community server (gpl) || version_compile_machine | x86_64 || version_compile_os | linux |+-------------------------+------------------------------+7 rows in set (0.00

方法8: mysqladmin -uroot -p -hlocalhost version 指令檢視mysql資料庫版本。其實這個方法也可以歸為方法1

 [root@db-server ~]# mysqladmin -uroot -p -hlocalhost version;enter password: mysqladmin ver 8.42 distrib 5.6.19, for linux on

x86_64copyright (c) 2000, 2014, oracle and/or its affiliates. all rights reserved. oracle is a registered trademark of oracle corporation and/or itsaffiliates. other names may be trademarks of their respectiveowners. server version 5.6.19protocol version 10connection

localhost via unix socketunix socket /var/lib/mysql/mysql.sockuptime: 2 hours 57 min 53 sec threads: 1 questions: 42 slow queries: 0 opens: 67 flush tables: 1 open tables: 60 queries per second avg: 0.003

參考資料:

<a target="_blank" href="http://dev.mysql.com/doc/refman/5.0/en/installation-version.html">http://dev.mysql.com/doc/refman/5.0/en/installation-version.html</a>

<a target="_blank" href="http://www.cnblogs.com/end/archive/2011/10/18/2216461.html">http://www.cnblogs.com/end/archive/2011/10/18/2216461.html</a>

檢視mysql資料庫的版本方法
檢視mysql資料庫的版本方法
檢視mysql資料庫的版本方法