您的位置:首页 > 数据库 > MySQL

查看mysql数据库版本方法总结

2015-12-18 10:12 337 查看
当你接手某个mysql数据库管理时,首先你需要查看维护的mysql数据库版本;当开发人员问你mysql数据库版本时,而恰好你又遗忘了,那么此时也需要去查看mysql数据库的版本..............。下文总结一下Linux平台下查看mysql数据库的方法.个人觉得总结的比较全面了。

方法1:登录数据库时,你可以看到对应mysql数据库的版本信息,如下所示:

[root@DB-Server~]#mysql-uroot-p


Enterpassword:


WelcometotheMySQLmonitor.Commandsendwith;or\g.


YourMySQLconnectionidis3


Serverversion:5.6.19MySQLCommunityServer(GPL)




Copyright(c)2000,2014,Oracleand/oritsaffiliates.Allrightsreserved.




OracleisaregisteredtrademarkofOracleCorporationand/orits


affiliates.Othernamesmaybetrademarksoftheirrespective


owners.




Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.




mysql>






方法二:使用系统函数查看mysql数据库版本。

mysql>selectversion();


+-----------+


|version()|


+-----------+


|5.6.19|


+-----------+


1rowinset(0.00sec)






mysql>select@@version;


+-----------+


|@@version|


+-----------+


|5.6.19|


+-----------+


1rowinset(0.00sec)




mysql>






方法3:使用status命令查看,如下所示,查看Serverversion后内容。

mysql>status


--------------


mysqlVer14.14Distrib5.6.19,forLinux(x86_64)usingEditLinewrapper




Connectionid:3


Currentdatabase:


Currentuser:root@localhost


SSL:Notinuse


Currentpager:stdout


Usingoutfile:''


Usingdelimiter:;


Serverversion:5.6.19MySQLCommunityServer(GPL)


Protocolversion:10


Connection:LocalhostviaUNIXsocket


Servercharacterset:latin1


Dbcharacterset:latin1


Clientcharacterset:utf8


Conn.characterset:utf8


UNIXsocket:/var/lib/mysql/mysql.sock


Uptime:2hours33min14sec




Threads:1Questions:22Slowqueries:0Opens:67Flushtables:1Opentables:60Queriespersecondavg:0.002


--------------






方法4:使用mysql-V命令查看

[root@DB-Server~]#mysql-V

mysqlVer14.14Distrib5.6.19,forLinux(x86_64)usingEditLinewrapper

[root@DB-Server~]#mysql--version

mysqlVer14.14Distrib5.6.19,forLinux(x86_64)usingEditLinewrapper

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

[root@DB-Server~]#mysql--help|grepDistrib

mysqlVer14.14Distrib5.6.19,forLinux(x86_64)usingEditLinewrapper

方法6:通过rpm命令查看安装包得知mysql数据库版本

[root@DB-Server~]#rpm-qa|grep-imysql

MySQL-client-5.6.19-1.rhel5

MySQL-server-5.6.19-1.rhel5

[root@DB-Server~]#

方法7:SHOWVARIABLES命令查看

mysql>SHOWVARIABLESLIKE"%version%";


+-------------------------+------------------------------+


|Variable_name|Value|


+-------------------------+------------------------------+


|innodb_version|5.6.19|


|protocol_version|10|


|slave_type_conversions||


|version|5.6.19|


|version_comment|MySQLCommunityServer(GPL)|


|version_compile_machine|x86_64|


|version_compile_os|Linux|


+-------------------------+------------------------------+


7rowsinset(0.00sec)




mysql>


方法8:mysqladmin-uroot-p-hlocalhostversion命令查看mysql数据库版本。其实这个方法也可以归为方法1



[root@DB-Server~]#mysqladmin-uroot-p-hlocalhostversion;


Enterpassword:


mysqladminVer8.42Distrib5.6.19,forLinuxonx86_64


Copyright(c)2000,2014,Oracleand/oritsaffiliates.Allrightsreserved.




OracleisaregisteredtrademarkofOracleCorporationand/orits


affiliates.Othernamesmaybetrademarksoftheirrespective


owners.




Serverversion5.6.19


Protocolversion10


ConnectionLocalhostviaUNIXsocket


UNIXsocket/var/lib/mysql/mysql.sock


Uptime:2hours57min53sec




Threads:1Questions:42Slowqueries:0Opens:67Flushtables:1Opentables:60Queriespersecondavg:0.003
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: