linux下查看数据库版本的5中方法

1.在Linux终端窗口中,输入mysql -V查看MySQL版本信息
[sky@qin ~]# mysql -V
mysql  Ver 14.14 Distrib 5.1.29-rc, for pc-linux-gnu (i686) using readline 5.1

2.在Linux终端窗口中,输入mysql --help | grep Distrib查看MySQL版本信息
[sky@qin ~]# mysql --help | grep Distrib
mysql  Ver 14.14 Distrib 5.1.29-rc, for pc-linux-gnu (i686) using readline 5.1

3.成功登录MySQL数据库即显示MySQL版本信息
[sky@qin ~]# mysql -uroot -pxinwei
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 32652
Server version: 5.1.29-rc-log MySQL Community Server (GPL)

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

//mysql命令行下的命令以分号(;)结束,遇到分号(;)即开始执行命令;
//connection id表示MySQL数据库的连接次数;
//5.1.29-rc-log MySQL Community Server 表示该版本是社区版本;
//(GPL)表示该版本是遵循GPL协议的;
//输入help;或者h,能查看帮助信息;
//输入c,能清除缓存,缓存中包括了之前已输入的命令;

4.登录MySQL数据库后,输入status查看MySQL版本信息
mysql> status
--------------
mysql  Ver 14.14 Distrib 5.1.29-rc, for pc-linux-gnu (i686) using readline 5.1

Connection id:          32652
Current database:
Current user:           sky@localhost
SSL:                    Not in use
Current pager:          stdout
Using outfile:          ''
Using delimiter:        ;
Server version:         5.1.29-rc-log MySQL Community Server (GPL)
Protocol version:       10
Connection:             Localhost via UNIX socket
Server characterset:    utf8
Db     characterset:    utf8
Client characterset:    utf8
Conn.  characterset:    utf8
UNIX socket:            /usr/local/mysql/data/mysql.sock
Uptime:                 20 hours 37 min 24 sec

Threads: 8  Questions: 634045  Slow queries: 0  Opens: 13622  Flush tables: 1  Open tables: 64  Queries per second avg: 7.785
--------------

5.登录MySQL数据库后,使用MySQL系统函数查看MySQL版本信息
mysql> select version();
+---------------+
| version()     |
+---------------+
| 5.1.29-rc-log |
+---------------+
1 row in set (0.00 sec)

博文仅供学习交流,转载请注明出处。

原文地址:https://www.cnblogs.com/da-guang/p/6428364.html