mysql find database command

View mysql database version method summary

2014-07-24 17:48 by Xiaoxiang Hermit, 98140 reads, 7 comments, collections , editing

When you take over the management of a mysql database, you first need to check the maintained mysql database version; when the developer asks you the mysql database version, and you just forget it, then you also need to check the mysql database version at this time.. ............ The following summarizes the method of viewing the mysql database under the Linux platform. Personally, the summary is more comprehensive.

 

Method 1: When logging in to the database, you can see the version information of the corresponding mysql database, as shown below:

 

[root@DB-Server ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.19 MySQL Community Server (GPL)
 
Copyright (c) 2000, 2014, 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.
 
mysql>

 

clip_image001

 

Method 2: Use the system function to check the mysql database version.

 

mysql> select version();
+-----------+
| version() |
+-----------+
| 5.6.19    |
+-----------+
1 row in set (0.00 sec)
 
 
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 5.6.19    |
+-----------+
1 row in set (0.00 sec)
 
mysql>

clip_image002

 

Method 3: Use the status command to view, as shown below, to view the content of the Server version.

 

mysql> status
--------------
mysql  Ver 14.14 Distrib 5.6.19, for Linux (x86_64) using  EditLine wrapper
 
Connection id:          3
Current database:
Current user:           root@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.6.19 MySQL Community Server (GPL)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    latin1
Db     characterset:    latin1
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /var/lib/mysql/mysql.sock
Uptime:                 2 hours 33 min 14 sec
 
Threads: 1  Questions: 22  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.002
--------------

clip_image003

 

方法4:使用mysql -V命令查看

 

[root@DB-Server ~]# mysql -V

mysql Ver 14.14 Distrib 5.6.19, for Linux (x86_64) using EditLine wrapper

[root@DB-Server ~]# mysql --version

mysql Ver 14.14 Distrib 5.6.19, for Linux (x86_64) using EditLine wrapper

 

方法5:在mysql --help命令内容中查找

 

[root@DB-Server ~]# mysql --help | grep Distrib

mysql Ver 14.14 Distrib 5.6.19, for Linux (x86_64) using EditLine wrapper

 

方法6:通过rpm命令查看安装包得知mysql数据库版本

 

[root@DB-Server ~]# rpm -qa | grep -i mysql

MySQL-client-5.6.19-1.rhel5

MySQL-server-5.6.19-1.rhel5

[root@DB-Server ~]#

 

方法7:SHOW VARIABLES 命令查看

mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------+
| Variable_name           | Value                        |
+-------------------------+------------------------------+
| innodb_version          | 5.6.19                       |
| protocol_version        | 10                           |
| slave_type_conversions  |                              |
| version                 | 5.6.19                       |
| version_comment         | MySQL Community Server (GPL) |
| version_compile_machine | x86_64                       |
| version_compile_os      | Linux                        |
+-------------------------+------------------------------+
7 rows in set (0.00 sec)
 
mysql> 

 

方法8: mysqladmin -uroot -p -hlocalhost version 命令查看mysql数据库版本。其实这个方法也可以归为方法1

 
[root@DB-Server ~]# mysqladmin -uroot -p -hlocalhost version;
Enter password: 
mysqladmin  Ver 8.42 Distrib 5.6.19, for Linux on x86_64
Copyright (c) 2000, 2014, 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.6.19
Protocol version        10
Connection              Localhost via UNIX socket
UNIX socket             /var/lib/mysql/mysql.sock
Uptime:                 2 hours 57 min 53 sec
 
Threads: 1  Questions: 42  Slow queries: 0  Opens: 67  Flush tables: 1  Open tables: 60  Queries per second avg: 0.003

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325517926&siteId=291194637