文章目录
- 一、mysql -V
- 二、登录数据库后会显示版本信息
- 三、mysqladmin -uroot -p version
- 四、select version()
- 五、命令 status
- 六、show variables like '%version%'
一、mysql -V
[root@htlwk0001host ~]# mysql -V
mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapper
注意:V 是大写
二、登录数据库后会显示版本信息
[root@htlwk0001host ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 702
Server version: 5.7.31 MySQL Community Server (GPL)Copyright (c) 2000, 2020, 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.
如上所示 Server version: 5.7.31 MySQL Community Server (GPL)
这就是数据库的版本信息
三、mysqladmin -uroot -p version
[root@htlwk0001host /]# mysqladmin -uroot -p version
Enter password:
mysqladmin Ver 8.42 Distrib 5.7.31, for Linux on x86_64
Copyright (c) 2000, 2020, 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.Server version 5.7.31
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 1 day 5 hours 41 min 13 secThreads: 21 Questions: 12030 Slow queries: 0 Opens: 114 Flush tables: 1 Open tables: 107 Queries per second avg: 0.112
四、select version()
查询数据库的版本号
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.7.31 |
+-----------+
1 row in set (0.00 sec)
五、命令 status
mysql> status
--------------
mysql Ver 14.14 Distrib 5.7.31, for Linux (x86_64) using EditLine wrapperConnection id: 1243
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.7.31 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: utf8mb4
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
UNIX socket: /var/lib/mysql/mysql.sock
Uptime: 1 day 6 hours 16 min 37 secThreads: 21 Questions: 12273 Slow queries: 0 Opens: 114 Flush tables: 1 Open tables: 107 Queries per second avg: 0.112
--------------
六、show variables like ‘%version%’
mysql> show variables like '%version%';
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| innodb_version | 5.7.31 |
| protocol_version | 10 |
| slave_type_conversions | |
| tls_version | TLSv1,TLSv1.1,TLSv1.2 |
| version | 5.7.31 |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | x86_64 |
| version_compile_os | Linux |
+-------------------------+------------------------------+
8 rows in set (0.00 sec)