Search and Replace MySQL

Performing a case-sensitive search-and-replace through a table is easy with MySQL when you know how.

UPDATE table_name SET table_field = REPLACE(table_field, 'replace_that', 'with_this');

This has proved useful for updating Drupal's files table where the paths are incorrect. I hope this helps someone

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options