How to retrieve the current version of a MySQL database management system (DBMS)?

后端 未结 20 2208
忘掉有多难
忘掉有多难 2020-11-28 18:06

What command returns the current version of a MySQL database?

相关标签:
20条回答
  • 2020-11-28 18:32

    I found a easy way to get that.

    Example: Unix command(this way you don't need 2 commands.),

    $ mysql -u root -p -e 'SHOW VARIABLES LIKE "%version%";'
    

    Sample outputs:

    +-------------------------+-------------------------+
    | Variable_name           | Value                   |
    +-------------------------+-------------------------+
    | innodb_version          | 5.5.49                  |
    | protocol_version        | 10                      |
    | slave_type_conversions  |                         |
    | version                 | 5.5.49-0ubuntu0.14.04.1 |
    | version_comment         | (Ubuntu)                |
    | version_compile_machine | x86_64                  |
    | version_compile_os      | debian-linux-gnu        |
    +-------------------------+-------------------------+
    

    In above case mysql version is 5.5.49.

    Please find this useful reference.

    0 讨论(0)
  • 2020-11-28 18:32

    Mysql Client version : Please beware this doesn't returns server version, this gives mysql client utility version

    mysql -version 
    

    Mysql server version : There are many ways to find

    1. SELECT version();

    1. SHOW VARIABLES LIKE "%version%";

    1. mysqld --version
    0 讨论(0)
  • 2020-11-28 18:35
    SHOW VARIABLES LIKE "%version%";
    +-------------------------+------------------------------------------+
    | Variable_name           | Value                                    |
    +-------------------------+------------------------------------------+
    | protocol_version        | 10                                       |
    | version                 | 5.0.27-standard                          |
    | version_comment         | MySQL Community Edition - Standard (GPL) |
    | version_compile_machine | i686                                     |
    | version_compile_os      | pc-linux-gnu                             |
    +-------------------------+------------------------------------------+
    5 rows in set (0.04 sec)
    

    MySQL 5.0 Reference Manual (pdf) - Determining Your Current MySQL Version - page 42

    0 讨论(0)
  • 2020-11-28 18:35

    In windows ,open Command Prompt and type MySQL -V or MySQL --version. If you use Linux get terminal and type MySQL -v

    0 讨论(0)
  • 2020-11-28 18:36

    Only this code works for me

    /usr/local/mysql/bin/mysql -V  
    
    0 讨论(0)
  • 2020-11-28 18:37

    Try this function -

    SELECT VERSION();
    -> '5.7.22-standard'
    

    VERSION()

    Or for more details use :

    SHOW VARIABLES LIKE "%version%";
    +-------------------------+------------------------------------------+
    | Variable_name           | Value                                    |
    +-------------------------+------------------------------------------+
    | protocol_version        | 10                                       |
    | version                 | 5.0.27-standard                          |
    | version_comment         | MySQL Community Edition - Standard (GPL) |
    | version_compile_machine | i686                                     |
    | version_compile_os      | pc-linux-gnu                             |
    +-------------------------+------------------------------------------+
    5 rows in set (0.04 sec)
    

    MySQL 5.0 Reference Manual (pdf) - Determining Your Current MySQL Version - page 42

    0 讨论(0)
提交回复
热议问题