dimitris kalamaras

math, social network analysis, web dev, free software…

How to replace a given string inside a mysql table?

Just use the fabulous command REPLACE provided by mysql. The syntax goes like this:

update database_table set table_column = replace (table_column, "oldstring", "newstring");

For instance, to replace all occurrences of “modules” inside the linuxformat.gr drupal db with “sites/all/modules” I typed in:

update linuxformat_system set filename = replace (filename, "modules", "sites/all/modules");

Share it!


Name-based Virtual Hosts in Apache


How-to configure file sharing in KDE4/Samba


  1. Avatar

    Excellent post and extremely useful !

  2. dimitris

    Thanks m8t 🙂

  3. Avatar


    Very useful, thx a lot

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress & Theme by Anders Norén