如何查询mysql版本
查看MySQL的版本,主要有以下几个方法:
1. 没有连接到MySQL服务器,就想查看MySQL的版本。打开cmd,切换至mysql的bin目录,运行下面的命令即可:
e:\mysql\bin>mysql-V mysqlVer14.14Distrib5.6.32,forWin32(AMD64) (版本为5.6.32)
或者:
e:\mysql\bin>mysql-v
这个命令可以查看到更为详细的信息,因为它会用账号 ODBC,连接上MySQL服务器,默认连接到localhost上的3306端口。
或者:
e:\mysql\bin>mysql--help|find"Distrib" mysqlVer14.14Distrib5.6.32,forWin32(AMD64)
这种方式只有windows系统下才可用,因为windows中才用find命令查找字符串,且后面的字符串必须用双引号包裹起来,而linux系统
下虽然也是用 | 作为管道符,却是使用grep命令查找字符串(如:mysql --help | grep Distrib)。
推荐:MySQL教程
2. 如果已经连接到了MySQL服务器,则运行下面的命令:
mysql>selectversion(); +------------+ |version()| +------------+ |5.6.32-log| +------------+ 1rowinset(0.00sec)
或者:
mysql> status;
-------------- mysqlVer14.14Distrib5.6.32,forWin32(AMD64) Connectionid:9 Currentdatabase: Currentuser:root@localhost SSL:Notinuse Usingdelimiter:; Serverversion:5.6.32-logMySQLCommunityServer(GPL) Protocolversion:10 Connection:localhostviaTCP/IP Servercharacterset:latin1 Dbcharacterset:latin1 Clientcharacterset:gbk Conn.characterset:gbk TCPport:3307 Uptime:4hours7min11sec Threads:4Questions:126Slowqueries:0Opens:73Flushtables:1Opentables:66Queriespersecond avg:0.008
或者:
mysql> \s
-------------- mysqlVer14.14Distrib5.6.32,forWin32(AMD64) Connectionid:9 Currentdatabase: Currentuser:root@localhost SSL:Notinuse Usingdelimiter:; Serverversion:5.6.32-logMySQLCommunityServer(GPL) Protocolversion:10 Connection:localhostviaTCP/IP Servercharacterset:latin1 Dbcharacterset:latin1 Clientcharacterset:gbk Conn.characterset:gbk TCPport:3307 Uptime:4hours9min29sec Threads:4Questions:144Slowqueries:0Opens:73Flushtables:1Opentables:66Queriespersecond avg:0.009
3. 在命令行连接上MySQL服务器时,其实就已经显示了MySQL的版本,如:
e:\mysql\bin>mysql -uroot -p -P3307
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.6.32-log MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
更多技术请关注Python视频教程。
本网站文章仅供交流学习 ,不作为商用, 版权归属原作者,部分文章推送时未能及时与原作者取得联系,若来源标注错误或侵犯到您的权益烦请告知,我们将立即删除.