I have taken over a Drupal 7 site which used to be on a different server and has now moved to ours. I have discovered that on lots of Pages, there are images which point to the wrong server name, the name being hard coded on the page. To save me having to load up each page to test (there are 1000's of them), I thought I could search the database for the value I wish to change. I can see page information is stored in the node table but thats just the page title, created at, type etc. Which table is the text on the page stored in? I have checked the settings.php file and the correct server name is in there. If I edit a page, I can see the html for the images that don't show on the page point to a completely different server

  • 3
    Save yourself the time and use the Views module to quickly make search Views for this.
    – Kevin
    May 28, 2021 at 13:28
  • Fields in Drupal have their own tables in db, you're probably looking for field_data_body. You can export the db and do a text replacement if you know what you're doing, then import it back. Other options are Feeds module, export into CSV, reimport after fixing it, or create a Text format filter that you can enable on text formats used on the Body that replace the string you want.
    – prkos
    May 28, 2021 at 13:46
  • fabulous, I currently can't access any of the module's and I am much more au fait with sql , I've found the info I want so I will change it in sql. Thanks May 28, 2021 at 14:16
  • It's more than one table since every field has a revision table. Again, I highly suggest using Views / Views Data Export / Views Bulk Edit before you put your database in a bad state from raw sql queries.
    – Kevin
    May 28, 2021 at 21:33

1 Answer 1


Here's a SQL-centric explainer: each field in Drupal 7 has two storage tables associated with it:

  • field_data_{name-of-field}
  • field_revision_{name-of-field}

In both cases, the field contents will be in a column like {name-of-field}_value. You can run a MYSQL UPDATE with a REPLACE function to bulk update URLs in these tables.

So if you find that the text you need to update is in the 'field_body' table:

UPDATE field_data_field_body SET field_body_value = REPLACE(field_body_value, 'oldurl.com', 'newurl.com');
UPDATE field_revision_field_body SET field_body_value = REPLACE(field_body_value, 'oldurl.com', 'newurl.com');

Immediately after running these queries, you must clear the Drupal cache. This is best done from the "Performance" admin page in the Drupal UI. If you insist on SQL-only remedies, you can clear the particular relevant cache with this:

TRUNCATE TABLE cache_field;

The regular caveats apply:

  • Have a backup of your database ready, and verify that the backup you have restores correctly!
  • Be judicious about your REPLACE functions, that you don't accidentally replace more than what you thought you were targeting.
  • Yes, you should perform the REPLACE against both the data and the revision tables.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.