1、未进入MySQL时查询:
1、mysql -V查询
C:\Users>mysql -V
mysql Ver 8.0.12 for Win64 on x86_64 (MySQL Community Server - GPL)
2、或者 mysql --version
C:\Users>mysql --version
mysql Ver 8.0.12 for Win64 on x86_64 (MySQL Community Server - GPL)
2、进入MySQL后查询
方式一
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.12 |
+-----------+
1 row in set (0.00 sec)
方式二
mysql> SHOW VARIABLES LIKE '%version%';
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| innodb_version | 8.0.12 |
| protocol_version | 10 |
| slave_type_conversions | |
| tls_version | TLSv1,TLSv1.1,TLSv1.2 |
| version | 8.0.12 |
| version_comment | MySQL Community Server - GPL |
| version_compile_machine | x86_64 |
| version_compile_os | Win64 |
| version_compile_zlib | 1.2.11 |
+-------------------------+------------------------------+
9 rows in set, 1 warning (0.00 sec)
方式三
mysql> status
--------------
mysql Ver 8.0.12 for Win64 on x86_64 (MySQL Community Server - GPL)
Connection id: 152
Current database:
Current user: root@localhost
SSL: Cipher in use is DHE-RSA-AES128-GCM-SHA256
Using delimiter: ;
Server version: 8.0.12 MySQL Community Server - GPL
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 4 days 3 hours 54 min 37 sec
Threads: 2 Questions: 3744 Slow queries: 0 Opens: 9056 Flush tables: 2 Open tables: 256 Queries per second avg: 0.010
--------------