[Snippet] How to Search and Replace String in MySQL or PHPMyAdmin

Imagine, you have a 10K records in a table in your database. And on each line, there is a character that you want to remove or replaced with other characters. If do it manually, it may take days. Creating a system or script to solve the problem it was still takes a lot of times.

I have even had a case like this and I am looking on the internet. Turns out there and very simple. MySQL has a replace function similar to PHP. Just use this in phpmyadmin  and all your problems will be completed.

UPDATE `table`
SET `field` = replace(field, 'unwanted_char', 'wanted_char')

Problems are solved in seconds… very help me.

Web developer, big fan of CakePHP, loving wordpress soo much. You can found him on Google+ and Facebook. Dont forget to follow him on Twitter.
Posts created 562

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.

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top