查看mysql版本

发布时间: 2023-11-21 10:26 阅读: 文章来源:1MUMB22PS

在日常项目开发过程中,我们经常要连接自己的数据库,此时不知道数据库的版本是万万不可的。今天小树懒来给大家总结一下查看mysql版本的方法。

MySQL查看版本的方法主要有以下四种

方法1:

没有连接到MySQL终端下直接使用mysql命令。打开cmd,切换至 MySQL的bin目录,运行以下命令:

[root@localhost lib]# mysql -VmysqlVer 15.1 Distrib 5.5.47-MariaDB, for Linux (x86_64) using readline 5.1方法2:

同样在终端使用命令

[root@localhost lib]# mysql --help | grep DistribmysqlVer 15.1 Distrib 5.5.47-MariaDB, for Linux (x86_64) using readline 5.1方法3:

如果已经连接到了 MySQL ,则可以登陆mysql之后使用内置命令

mysql> select version();+----------------+| version()|+----------------+| 5.5.47-MariaDB |+----------------+1 row in set (0.00 sec)方法4:

同样登录MySQL,使用内置命令

mysql> status;--------------mysqlVer 15.1 Distrib 5.5.47-MariaDB, for Linux (x86_64) using readline 5.1 Connection id:4Current database:Current user:root@localhostSSL:Not in useCurrent pager:stdoutUsing outfile:‘‘Using delimiter:;Server: MariaDBServer version: 5.5.47-MariaDB MariaDB ServerProtocol version:10Connection: Localhost via UNIX socketServer characterset:latin1Db characterset:latin1Client characterset:utf8Conn.characterset:utf8UNIX socket:/var/lib/mysql/mysql.sockUptime: 2 min 56 sec Threads: 1Questions: 12Slow queries: 0Opens: 0Flush tables: 2Opentables: 4Queries per second avg: 0.068

或者

mysql> \s--------------mysqlVer 14.14 Distrib 5.6.32, for Win32 (AMD64)Connection id:9Current database:Current user:root@localhostSSL:Not in useUsing delimiter:;Server version: 5.6.32-log MySQL Community Server (GPL)Protocol version:10Connection: localhost via TCP/IPServer characterset:latin1Db characterset:latin1Client characterset:gbkConn.characterset:gbkTCP port:3307Uptime: 4 hours 9 min 29 secThreads: 4Questions: 144Slow queries: 0Opens: 73Flush tables: 1Open tables: 66Queries per second avg: 0.009

以上就是常见的四种mysql查看版本的方法。

其实,在命令行连接上MySQL服务器时,其实就已经显示了MySQL的版本,如:

e:\mysql\bin>mysql -uroot -p -P3307Enter password:Welcome to the MySQL monitor.Commands end with ; or \g.Your MySQL connection id is 10Server 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 itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

欢迎点击下方“了解更多

•••展开全文