SQL 搜索和替换 [英] SQL Search and Replace

查看:34
本文介绍了SQL 搜索和替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

诚然,当谈到 SQL 命令时,我是个菜鸟.一名黑客在我的一个 WordPress 网站上的每篇文章和页面的末尾插入了一个脚本标签,我正在尝试在wp_posts"表中进行查找和替换,但是当我运行模拟查询.这是我所拥有的:

Admittedly, I'm a noob when it comes to SQL commands. A hacker inserted a script tag at the end of every post and page on one of my WordPress sites, and I'm trying to do a find and replace in the 'wp_posts' table but I keep getting a #1064 error when I run a Simulate Query. Here's what I have:

UPDATE wp_posts SET post_content=REPLACE(post_content, '<script type="text/javascript" src="http://www.hcifx.com/troyengelhardt/index1261.php"></script>', '');

无论我在第一组 'find' 引号中放什么,我都会收到错误,即使它是像 'hcifx' 这样简单的东西,而不是显示的整个脚本标签.知道我哪里出错了吗?

I get the error no matter what I put inside that first set of 'find' quotes, even if it's something as simple as 'hcifx' instead of the entire script tag shown. Any ideas where I'm going wrong?

推荐答案

事实证明该错误是 PhpMyAdmin 中的一个已知错误.查询有效,但使用模拟查询"函数会引发错误错误.我备份了我的数据库并按写入的方式运行查询,它成功地从 db 表中的所有帖子中删除了有问题的代码.

It turns out the error is a known bug in PhpMyAdmin. The query was valid, but using the 'Simulate Query' function throws an erroneous error. I backed up my database and ran the query as written and it successfully stripped the offending code from all posts in the db table.

这篇关于SQL 搜索和替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆