phpMyAdmin is the best, free and open source tool that is used to handle MySQL databases from the web browser itself. It is provided by all the major web hosting provides and can perform almost any task, ranging from creating, altering, deleting databases, columns, rows and tables. It can also execute SQL queries, can add/edit/delete users and can even be used to view data.
Why To Perform Search And Replace With phpMyAdmin
How To Perform Search And Replace With phpMyAdmin
- Open phpMyAdmin.
- From the left pane, select the database you want to perform search and replace on.
- Click on the “SQL” tab in the top navigation.
Now in the text area paste the following code, replacing
- “table_name” with the name of the table,
- “column_name” with the name of the column,
- “replace this item” with the item that needs to be replaced,
- “replace with this item” with the item you want to replace it with.
UPDATE table_name SET column_name = REPLACE ( column_name, 'replace this item', 'replace with this item');
- Now press the “Go” button and that’s all. You have successfully replaced all the occurrences of the undesired item with the desired one using phpMyAdmin.
NOTE If you make a mistake in typing or copying the query, it can make your database useless completely. Please take a complete backup of your database beforehand using the “Export” feature in phpMyAdmin itself, present in the top navigation menu.
Perform Search And Replace in phpMyAdmin on WordPress Database
Most of the people have asked me about changing all the occurrences of a particular item in WordPress post content. There are plugins that can do this quite easily but to do it using phpMyAdmin you have to take the same steps but the query can be made a little more specific.
The Query
UPDATE wp_posts SET post_content = REPLACE (
post_content,
'replace this item',
'replace with this item');
The query above is specifically for WordPress post content. Just follow the general process of search and replace in phpMyAdmin and change the query with this one.
REMEMBER Don’t forget to change the items.
Play Safe…