【网络安全实验】解决 ERROR 1064 (42000): You have an error in your SQL syntax ... near …
发布日期:2021-06-29 14:32:39 浏览次数:3 分类:技术文章

本文共 818 字,大约阅读时间需要 2 分钟。

背景

今天做网络安全的时候,遇到了这个错误,这个问题之前遇到过几次,但是总是会因为疏忽又相遇,今天把这个问题写出来,加深印象吧。

任务

操作4:联合查询猜字段数

联合查询字段数量不同:select user,password from users union selectuser,password  from mysql.user;猜前面的查询字段数select user,first_name,password from users union select 1;select user,first_name,password from users union select 1,2;....

报错如下:

select user,password from users union select user,password  from mysql.user;ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':select user,first_name,password from users union select user,password  from ' at line 1

解决

其实这个问题就是语法上的错误,在MySQL中,为了区分MySQL的关键字与普通字符,MySQL引入了一个反引号。

详情见:

反引号不知道在哪?(快看下面这张图吧…)

select `user`,`password` from users union select `user`,`password`  from mysql.user;

再次运行就不会报错了

学如逆水行舟,不进则退

转载地址:https://chocolate.blog.csdn.net/article/details/106690378 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:【建议前端必刷】 用 js 刷LeetCode 算法专题(全)
下一篇:php-rabbitmq结合rabbitmq_delayed_message_exchange实现延时队列

发表评论

最新留言

不错!
[***.144.177.141]2024年04月12日 06时49分19秒