Search/Find and Replace Using phpMyAdmin and MySQL

I’ve had to do this quite a few times lately seen as though I moved from bBlog to WordPress, there were some things I wanted to change, for example all posts that references /contact.php I wanted to change to /contact/ to fit the new permalink structure.

So for example in that case go to Cpanel (assuming you are using it) which will give you access to phpMyAdmin.

First you need to login to Cpanel with the username/password provided to you by your host, following that find the MySQL Databases link and click that.

phpMyAdmin SQL MySQL

Then at the bottom you’ll see a link to phpMyAdmin, this is a web based management system for MySQL databases.

phpMyAdmin SQL MySQL

At the top left you can then select your database.

phpMyAdmin SQL MySQL

After that click the small SQL icon and a window should pop-up like this:

phpMyAdmin SQL MySQL

There you can enter your SQL statement.

To update something it’s in the form of:

update table_name set field_name = replace(field_name,'replace_this','with_this');

So the example I used above for WordPress would be:

update wp_posts set post_content = replace(post_content,'/contact.php','/contact/');

Pretty useful for general housekeeping or during a conversion/update.

Comments

comments

Subscribe

You can subscribe via e-mail to get my posts in your Inbox, or stalk me on numerous other platforms.

, , , , ,


4 Responses to Search/Find and Replace Using phpMyAdmin and MySQL

  1. Paul Tan January 17, 2006 at 3:13 pm #

    good tip

  2. spiller January 17, 2006 at 4:39 pm #

    how much i owe u? can i buy u beer instead? =P

  3. ShaolinTiger January 17, 2006 at 4:51 pm #

    spliller: Beer, Liquor, nice seafood makan..I accept them all!

  4. nospam March 2, 2011 at 1:48 pm #

    gosh, you can do without all the annoying distortion of the images

 
Keep up with me on Social Media by following me below - Thanks so much!