方式一:登陆命令行的信息提示

mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19825
Server version: 5.7.25-0ubuntu0.18.04.2 (Ubuntu)

Copyright (c) 2000, 2019, 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.

方式二:命令行下使用 status 命令

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using  EditLine wrapper

Connection id:        19825
Current database:
Current user:        root@localhost
SSL:            Not in use
Current pager:        stdout
Using outfile:        ''
Using delimiter:    ;
Server version:        5.7.25-0ubuntu0.18.04.2 (Ubuntu)
Protocol version:    10
Connection:        Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:        /var/run/mysqld/mysqld.sock
Uptime:            11 days 9 hours 34 min 22 sec

Threads: 1  Questions: 495036  Slow queries: 0  Opens: 693  Flush tables: 1  Open tables: 566  Queries per second avg: 0.502
--------------

方式三:使用 select version(); 查询

mysql> select version();
+-------------------------+
| version()               |
+-------------------------+
| 5.7.25-0ubuntu0.18.04.2 |
+-------------------------+
1 row in set (0.02 sec)

方式四:使用 mysql --version 命令

root@t1:~# mysql --version
mysql  Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using  EditLine wrapper

方式五: 包管理工具(根据不同系统 rh系列或bsd系列)

debian/ubuntu 使用 dpkg --list | grep mysql centos 或 redhat 使用: rpm -qa | grep mysql

以 Ubuntu 为例:

root@t1:~# dpkg --list | grep mysql
ii  libmysqlclient20:amd64                5.7.25-0ubuntu0.18.04.2                    amd64        MySQL database client library
ii  mysql-client-5.7                      5.7.25-0ubuntu0.18.04.2                    amd64        MySQL database client binaries
ii  mysql-client-core-5.7                 5.7.25-0ubuntu0.18.04.2                    amd64        MySQL database core client binaries
ii  mysql-common                          5.8+1.0.4                                  all          MySQL database common files, e.g. /etc/mysql/my.cnf
ii  mysql-server                          5.7.25-0ubuntu0.18.04.2                    all          MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.7                      5.7.25-0ubuntu0.18.04.2                    amd64        MySQL database server binaries and system database setup
ii  mysql-server-core-5.7                 5.7.25-0ubuntu0.18.04.2                    amd64        MySQL database server binaries
ii  php-mysql                             1:7.2+60ubuntu1                            all          MySQL module for PHP [default]
ii  php7.2-mysql                          7.2.15-0ubuntu0.18.04.2                    amd64        MySQL module for PHP

标签: mysql

添加新评论