Find and Replace text in the entire table using a MySQL query

Do you have SSH access? WP-CLI via search-replace.

$ wp search-replace '<script>bad javascript code</script>' '' --precise

By default, this only searches for tables registered in $wpdb. To overwrite this behaviour, you can use either the --all-tables or --all-tables-with-prefix flag. (Or pass table names to the command manually.)

Alternative: Easiest would be to download a dump, search/replace in that file and finally import again.

  1. Download complete db backup
  2. search & replace with your favourite text editor, replacing <script>bad javascript code</script> through an empty string
  3. Delete tables
  4. Upload your edited backup