0x00 查询MySql安装路径
select @@basedir;
mysql> select @@basedir;
+--------------------------------+
| @@basedir |
+--------------------------------+
| D:/phpStudy/PHPTutorial/MySQL/ |
+--------------------------------+
1 row in set (0.00 sec)
0x01 查询当前连接数据库
select database();
mysql> select database();
+------------+
| database() |
+------------+
| test |
+------------+
1 row in set (0.00 sec)
0x02 查询用户
select user();
mysql> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
select current_user;
mysql> select current_user;
+----------------+
| current_user |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
select current_user();
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
select system_user();
mysql> select system_user();
+----------------+
| system_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
select SESSION_USER();
mysql> select SESSION_USER();
+----------------+
| system_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
0x03 查询当前连接的数据库版本
select version();
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.53 |
+-----------+
1 row in set (0.00 sec)
select @@version;
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 5.5.53 |
+-----------+
1 row in set (0.00 sec)
0x04 文件读取最大值
select @@max_allowed_packet;
mysql> select @@max_allowed_packet;
+----------------------+
| @@max_allowed_packet |
+----------------------+
| 1048576 |
+----------------------+
1 row in set (0.00 sec)
0x05 查看MySQL数据存储路径
select @@datadir
mysql> select @@datadir;
+----------------------------------------------+
| @@datadir |
+----------------------------------------------+
| E:\phpstudy_pro\Extensions\MySQL5.7.26\data\ |
+----------------------------------------------+
1 row in set (0.00 sec)
0x06 连接数据库的用户名
select session_user()
mysql> select session_user();
+----------------+
| session_user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
0x07 数据库服务器的信息
select @@version_comment
mysql> select @@version_comment;
+------------------------------+
| @@version_comment |
+------------------------------+
| MySQL Community Server (GPL) |
+------------------------------+
1 row in set (0.00 sec)
0x08 操作系统版本
select @@version_compile_os
mysql> select @@version_compile_os;
+----------------------+
| @@version_compile_os |
+----------------------+
| Win64 |
+----------------------+
1 row in set (0.00 sec)
0x09 查看机器的型号
select @@version_compile_machine
mysql> select @@version_compile_machine;
+---------------------------+
| @@version_compile_machine |
+---------------------------+
| x86_64 |
+---------------------------+
1 row in set (0.00 sec)