This is handy when you want to swap or lose an identical content string across all the data entries in a db table field.
Use it with care but, hey, talk about a time saver.
Log into your CLI, then into mysql like this:-
.. and input your mysql password.
Now, let's open the database we want to manipulate:-
.. where database is the name of your db.
The command itself:-
OK. Here's an example.
Let's say you've got a WordPress blog littered with references to some bloke called Jack, but Jack just had a change of mind and now answers to the name of Jill. OK, sorry, but bear with me, it's a spur of the moment example. So you want to swap Jack for Jill.
The string Jack can be found in a specific field within a specific table. In this case, and with WordPress, the table is wp_posts and the field within is post_content. We've already specified our db. When making the content change, we must now isolate the field, within its table.
Here's the code:-
MySQL will come back and tell you it's done with something like:-
And to Delete a String of Content in MySQL?
Probably there are other ways to do this, but this related method works for me:-
.. Now we've replaced Jack with nothing. He's gone.