渗透测试---SQL注入~mysql数据库注入基础

SQL Server的内置数据库master与MySQL的内置数据库information_schema相似。

通过Navicat远程连接MySQL数据库后,我们可以看到:

MySQL内置数据库information_schema中:

schemata表存储了所有库名。

tables表存储了所有表名对应库名。

columns表存储了所有字段名对应表名对应库名。

所以

查库:

select schema_name from information_schema.schemata;

查表:

select table_name from information_schema.tables where table_schema='security';

查字段:

select column_name from information_schema.columns where table_schema='security' and table_name='users';

查内容:

知道库名,表名和字段名之后,我们就可以直接查内容了。

select username,password from security.users;

查询服务器主机信息:

主机名称@@hostname

数据库路径@@datadir

操作系统版本@@version_compile_os

select @@hostname,@@datadir,version_compile_os;

查看当前数据库:

select database();

查看数据库版本:

select version();

select @@version;

select @@global.version;

猜你喜欢

转载自www.cnblogs.com/123456ZJJ/p/12759356.html