mysql
在mysql5.0以上的版本中,为了方便管理,默认定义了information_schema数据库,用来数据库元信息。其中具有表schemata(数据库名)、tables(表名)、columns(列名)
在schemata表中,schemata_name字段用来存储数据库名
在tables表中,table_schema和table_name分别用来存储数据库名和表名
在coumns表中,table_schema(数据库名)、table_name(表名)、column_name(字段名)
利用Navicate for Mysql 查看结构
SQL增删改查
select 列名称 from 表名称 where 字段1 = '条件1' and 字段2='条件2';
insert into table name(列1,列2...) values(值1,值2);
update 表名称 set 列名称 = 新值 where 列名称 = 值;
delete from table where 列名称 = 值
MySQL常用函数
mysql中常用的聚合函数如下:
user():查看当前mysql的登录用户名
database():查看当前使用mysql的数据库名
version():查看当前mysql的版本
mysql> select user();
+----------------+
| user() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
mysql> select database();
+------------+
| database() |
+------------+
| NULL |
+------------+
1 row in set (0.00 sec)
mysql> select version();
+-----------+
| version() |
+-----------+
| 5.5.21 |
+-----------+
1 row in set (0.00 sec)
注释
注释符:在mysql中常见的注释符表达式:#或--空格或/**/
空格可以使用%20转义
内联注释:/*!SQL语句*/只有mysql可以识别,常用来绕过waf
例如:
select * from articles where id = id
使用内联注释注入
select * from articles where id = -1 /*!union*/ /*!select*/ 1,2,3,4
浙公网安备 33010602011771号