dimitris kalamaras

mathematics, social network analysis, 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");

Previous

Name-based Virtual Hosts in Apache

Next

How-to configure file sharing in KDE4/Samba

3 Comments

  1. Excellent post and extremely useful !

  2. Thanks m8t 🙂

  3. asteia

    Very useful, thx a lot

Leave a Reply

Creative Commons License
Licensed under a Creative Commons Attribution-ShareAlike 4.0 International License - Powered by Linux