0x00 查询MySql安装路径

select @@basedir;

  1. mysql> select @@basedir;
  2. +--------------------------------+
  3. | @@basedir |
  4. +--------------------------------+
  5. | D:/phpStudy/PHPTutorial/MySQL/ |
  6. +--------------------------------+
  7. 1 row in set (0.00 sec)

0x01 查询当前连接数据库

select database();

  1. mysql> select database();
  2. +------------+
  3. | database() |
  4. +------------+
  5. | test |
  6. +------------+
  7. 1 row in set (0.00 sec)

0x02 查询用户

select user();

  1. mysql> select user();
  2. +----------------+
  3. | user() |
  4. +----------------+
  5. | root@localhost |
  6. +----------------+
  7. 1 row in set (0.00 sec)

select current_user;

  1. mysql> select current_user;
  2. +----------------+
  3. | current_user |
  4. +----------------+
  5. | root@localhost |
  6. +----------------+
  7. 1 row in set (0.00 sec)

select current_user();

  1. mysql> select current_user();
  2. +----------------+
  3. | current_user() |
  4. +----------------+
  5. | root@localhost |
  6. +----------------+
  7. 1 row in set (0.00 sec)

select system_user();

  1. mysql> select system_user();
  2. +----------------+
  3. | system_user() |
  4. +----------------+
  5. | root@localhost |
  6. +----------------+
  7. 1 row in set (0.00 sec)

select SESSION_USER();

  1. mysql> select SESSION_USER();
  2. +----------------+
  3. | system_user() |
  4. +----------------+
  5. | root@localhost |
  6. +----------------+
  7. 1 row in set (0.00 sec)

0x03 查询当前连接的数据库版本

select version();

  1. mysql> select version();
  2. +-----------+
  3. | version() |
  4. +-----------+
  5. | 5.5.53 |
  6. +-----------+
  7. 1 row in set (0.00 sec)

select @@version;

  1. mysql> select @@version;
  2. +-----------+
  3. | @@version |
  4. +-----------+
  5. | 5.5.53 |
  6. +-----------+
  7. 1 row in set (0.00 sec)

0x04 文件读取最大值

select @@max_allowed_packet;

  1. mysql> select @@max_allowed_packet;
  2. +----------------------+
  3. | @@max_allowed_packet |
  4. +----------------------+
  5. | 1048576 |
  6. +----------------------+
  7. 1 row in set (0.00 sec)