天天看點

【轉】爛泥:檢視MySql版本号指令

在 MS-SQL Server 中用 select @@version 可以很友善的檢視到版本号,在 MySQL 中也有類似的方法的去檢視版本号,這裡介紹四中不同的方法,它們分别運作在不同的環境中,最後對每種方法的優劣以及使用範圍也做了總結。

1. 直接在作業系統指令行下執行:MySQL –V

C:\>MySQL -V

MySQL Ver 14.12 Distrib 5.0.23, for Win32 (ia32)

2. MySQL 用戶端指令:status (縮寫為 \s)

可以使用mysql –u root –p指令登入

<a href="http://ilanni.blog.51cto.com/attachment/201401/17/526870_1389964235gG95.png" target="_blank"></a>

<a href="http://ilanni.blog.51cto.com/attachment/201401/17/526870_1389964235Ga1U.png" target="_blank"></a>

MySQL&gt; status

<a href="http://ilanni.blog.51cto.com/attachment/201401/17/526870_13899642364sSW.png" target="_blank"></a>

MySQL&gt; \s

<a href="http://ilanni.blog.51cto.com/attachment/201401/17/526870_1389964237p2NU.png" target="_blank"></a>

3. 使用 MySQL 變量:show variables like '%version%'

MySQL&gt;

<a href="http://ilanni.blog.51cto.com/attachment/201401/17/526870_1389964238zvWN.png" target="_blank"></a>

或者

<a href="http://ilanni.blog.51cto.com/attachment/201401/17/526870_1389964239DPXl.png" target="_blank"></a>

<a href="http://ilanni.blog.51cto.com/attachment/201401/17/526870_1389964239yeFv.png" target="_blank"></a>

4. 使用 MySQL 函數:version()

MySQL&gt; select version();

<a href="http://ilanni.blog.51cto.com/attachment/201401/17/526870_1389964240mAOy.png" target="_blank"></a>

<a href="http://ilanni.blog.51cto.com/attachment/201401/17/526870_1389964242zdtT.png" target="_blank"></a>

以上四種方法都可以檢視 MySQL 的版本号,它們都适用于 Linux 和 windows,其中:(1). MySQL -V 隻能在安裝 MySQL 的伺服器上執行;(2). status (\s)指令最為簡便,但也隻能在 MySQL 的指令行用戶端(MySQL Command Line Client)中執行;(3). show variables like '%version%' 和 (4). select version() 最為通用,可以在 MySQL 的指令行用戶端和各種圖形用戶端(如 MySQL Query Browser, SQLyog, EMS SQL Manager)中執行。

本文轉自 爛泥行天下 51CTO部落格,原文連結:http://blog.51cto.com/ilanni/1352680

繼續閱讀