This post is for myself. I usually like to change database and forget the commands. So this is a reference sheet for me while dealing with my WordPress database.
There usually are 11 default tables – with “wp_” prefix.
wp_options is the one I usually deal with while changing the directory, website address and so on.
RENAME TABLE old_posts TO wp_posts;
Merging two tables (when I manually merge posts from two separate blogs. )
CREATE TABLE wp_post_merged SELECT DISTINCT * FROM (SELECT * FROM wp_post_1 UNION ALL SELECT * FROM wp_post_2) sq;
Replacing a text string in a table
UPDATE table_name SET column_name = replace(column_name, 'DeleteThis', 'AddThis');
UPDATE wp_posts SET post_content = replace(post_content, 'Apple computers', 'MS computers');
Incoming search terms:
- https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1832 SxXy7jS-pFrBRTDjYL46kSlv9oh26vVQPA7V6zr6IRKTC_d3yXcDsL7WVY1OfKGK fa3dcf2402552070d5fff00400f6a4c3769a103b&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme