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

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

What command returns the current version of a MySQL database?

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

    For UBUNTU you can try the following command to check mysql version :

    mysql --version
    
    0 讨论(0)
  • 2020-11-28 18:25

    Many answers suggest to use mysql --version. But the mysql programm is the client. The server is mysqld. So the command should be

    mysqld --version
    

    or

    mysqld --help
    

    That works for me on Debian and Windows.

    When connected to a MySQL server with a client you can use

    select version()
    

    or

    select @@version
    
    0 讨论(0)
  • 2020-11-28 18:26

    mysqladmin version OR mysqladmin -V

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

    With CLI in one line :

    mysql --user=root --password=pass --host=localhost db_name --execute='select version()';

    or

    mysql -uroot -ppass -hlocalhost db_name -e 'select version()';

    return something like this :

    +-----------+
    | version() |
    +-----------+
    | 5.6.34    |
    +-----------+
    
    0 讨论(0)
  • 2020-11-28 18:29

    For Mac,

    1. login to mysql server.

    2. execute the following command:

       SHOW VARIABLES LIKE "%version%";
      
    0 讨论(0)
  • 2020-11-28 18:30

    Here two more methods:

    Linux: Mysql view version: from PHP

    From a PHP function, we can see the version used:

    mysql_get_server_info ([resource $ link_identifier = NULL]): string
    

    Linux: Mysql view version: Package version

    For RedHat / CentOS operating systems:

    rpm -qa | grep mysql
    

    For Debian / Ubuntu operating systems:

    rpm -qa | grep mysql
    

    Extracted from: https://www.sysadmit.com/2019/03/linux-mysql-ver-version.html

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