查看数据库版本及当前登录用户是什么?
查看数据库当前版本:
1)mysql> select version(); ==>查看mysql版本;(在库里面查看)
+------------+
| version() |
+------------+
| 5.5.32-log |
+------------+
1 row in set (0.00 sec)
2)mysql> status; ==>查看当前数据库状态,包括数据库版本、当前用户,socket等;
--------------
mysql Ver 14.14 Distrib 5.5.32, for Linux (x86_64) using readline 5.1
Connection id: 7
Current user: root@localhost
Server version: 5.5.32-log Source distribution
Protocol version: 10
UNIX socket: /data/3306/mysql.sock
Uptime: 48 min 46 sec
3)[root@centos66 ~]# mysql -V ==>在命令行中查看数据库版本
mysql Ver 14.14 Distrib 5.5.32, for Linux (x86_64) using readline 5.1
4)[root@centos66 ~]# mysql --help|grep -i distrib
mysql Ver 14.14 Distrib 5.5.32, for Linux (x86_64) using readline 5.1
查看当前登陆的用户:
1)mysql> select user(); ==>查看当前用户;
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
2)status;状态信息中也包括当前用户;