Method: 1. Use the "select version();" statement to query; 2. Use the "show variables like '%version%'" statement to query; 3. Use the "status" command in the mysql client to query ;4. Use "mysql -V" to query in the terminal.
The operating environment of this tutorial: linux7.3 system, mysql8.0.22 version, Dell G3 computer.
1. Use MySQL function:
select version();
2. Use MySQL variable:
show variables like ‘%version%’
3. MySQL client command: status (abbreviated as \s)
status (\s) command is the simplest, but it can only be used in the MySQL command line client. Execute
4 in the client (MySQL Command Line Client), the parameter is -V (capital letters) or --version
Usage method:
mysql -V
Or
mysql --version
Disadvantages can only be executed on the server where Mysql is installed
Extended knowledge:
1. Log in to mysql using the terminal command – u root -p, the login log also contains the version number
Disadvantages need to reconnect and log in
2. Enter rpm -qa | grep mysql
at the terminal. This is It is used to check the version number of the mysql installation package. In fact, it is useless to see the version number of the installation package.
Recommended learning:mysql video tutorial
The above is the detailed content of How to query the database version in mysql. For more information, please follow other related articles on the PHP Chinese website!