直接学习:https://edu.csdn.net/course/play/27328/370720
黑客常说的SQL注入是什么?
#1、SQL注入(sql injection )是指应用程序对用户输入数据的合法性没有判断,没有过滤攻击者可以在应用程序中通过表单提交特殊的字符串,该特殊字符串会改变SQL语句的运行结果,从而在管理员毫不知情的情况下实现非法操作,以此来实现欺骗数据库的执行非授权的任意查询。
#2、示例代码入下:
create table user(
id int not null auto_increment primary key,
username varchar(30) comment '用户名',
password varchar(30) comment '密码'
);
insert into user(username,password) values('admin','123456');
insert into user(username,password) values('test','123456');
select * from user where username='admin' and password = '123456';
select * from user where username='test' and password = '123456';
select * from user where username='xyz' and password ='' or '1'='1';