mysql查看版本的方法


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

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

[root@localhost lib]# mysql -V
mysql  Ver 15.1 Distrib 5.5.47-MariaDB, for Linux (x86_64) using readline 5.1

mysql查看版本的方法2: 同样在终端使用命令

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

mysql查看版本的方法3: 如果已经连接到了 MySQL ,则可以登陆mysql之后使用内置命令

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

mysql查看版本的方法4: 同样登录MySQL,使用内置命令

mysql> status;
--------------
mysql  Ver 15.1 Distrib 5.5.47-MariaDB, for Linux (x86_64) using readline 5.1
 
Connection id:          4
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server:                 MariaDB
Server version:         5.5.47-MariaDB MariaDB Server
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 2 min 56 sec
 
Threads: 1  Questions: 12  Slow queries: 0  Opens: 0  Flush tables: 2  Opentables: 4  Queries per second avg: 0.068

或者

mysql> \s
--------------
mysql  Ver 14.14 Distrib 5.6.32, for Win32 (AMD64)

Connection id:          9
Current database:
Current user:           root@localhost
SSL:                    Not in use
Using delimiter:        ;
Server version:         5.6.32-log MySQL Community Server (GPL)
Protocol version:       10
Connection:             localhost via TCP/IP
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    gbk
Conn.  characterset:    gbk
TCP port:               3307
Uptime:                 4 hours 9 min 29 sec

Threads: 4  Questions: 144  Slow queries: 0  Opens: 73  Flush tables: 1  Open tables: 66  Queries per second avg: 0.009

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

其实,在命令行连接上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.

评论区(0)

评论