String Replace in mysql

Post

Say that you have a database full of blog posts and by chance you have misspelled a word many times throughout your blogging. You may think that you will have to go back and edit each of your blog posts but if you have access to the database you can run a replace on all of them and fix your mistake.

String replacements in mysql are pretty simple, the standard syntax being
REPLACE([string or column],'thing to replace','thing to substitute')

You could run a replace update query on your blog post database,
update blog_post set post_body = REPLACE(post_body,'axcident','accident');

This will save you lots of time and labor in editing each post.

Comments

Leave a comment

November 2026
Sun
Mon
Tue
Wed
Thu
Fri
Sat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Share