Find and Replace With phpMyAdmin (or using SQL)

Hints HOWTOs WordPress

Ever need to find and replace something in your WordPress database? (perhaps you changed domain names and have the old domain name or folder structure hard coded into some of your posts) You can easily update your database by using phpMyAdmin or by using the following code in any SQL interface:

UPDATE wp_posts SET post_content = replace(post_content,"http://olddomain.com/blog","newdomain.com/"); 

The first part of the command says “update the database table wp_posts” (where your content is stored). The later part of the command says “use the field “post_content” (where all your actual post content is stored” and then find “http://olddomain.com/blog” and replace it with “http://newdomain.com”. You can find anything (not limited to domain name) and replace it with anything as well. This is a great time saver!

2 thoughts on “Find and Replace With phpMyAdmin (or using SQL)”

  1. SQL Tutorials

    Does anyone know if there is another language or set of commands beside SQL for talking with databases?

    I’m working on a project and am doing some research thanks

  2. SQL Tutorials

    You know, the thing about SQL is, that there is virtually nothing that can replace it.

    Does anyone know if a substitute exists for sql? I mean besides MS SQL and Oracle and all that jazz. Thanks.

Leave a Reply

Your email address will not be published.
*
*

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

Apple Serenity Now!

Lost iTunes Music

Recently I had my backup drive die which doubled as my music drive (dumb). I also in the past few weeks – cleaned out my off site backups which included my music (dumb). After not being very excited with what happened – I decided to do some research on some of my options to get […]

Web Development

view-source: Firefox

I am generally a Safari user to do my web browsing unless I am debugging a web site – then I use Firefox because of the great web developer extensions. I cannot believe I did not know this before, but if you want to quickly view the source of anything (I just used it to […]