---
title: "Find and replace in MySQL - using PHP"
date: "2011-01-04"
modified: "2013-03-04"
path: "/63-find-and-replace-in-mysql-using-php.html"
section: "/ramblings"
aliases:
  - "/63"
  - "/63-find-and-replace-in-mysql-using-php"
  - "/63.html"
  - "/blog/findandreplaceinmysql-usingphp"
  - "/ramblings/63-find-and-replace-in-mysql-using-php.html"
---

No point in re-inventing the wheel, this is very handy:

<http://www.mjdigital.co.uk/blog/search-and-replace-text-in-whole-mysql-database/>

GPL version of updated tool:

<https://launchpad.net/mysql-search-replace>

Update: below is my copy of the script modified to use LIKE instead of REGEX. This best suited my requirement to find and replace URL's. I also added "\`" style quotes for Joomla's funny use of reserved names for fields!

<https://gist.github.com/1037832>
