garethEds Posted September 8, 2014 Posted September 8, 2014 Afternoon All, I wonder if anyone can tell me how to use a MySQL command to change a string wherever it appears on a website. We are using Wordpress and I can access MySQL through phpMyAdmin with the host. Quite simply I need to change Ysgol Gyfun Gwyr to Ysgol Gyfun Gŵyr - but there are rather a lot of them. I have started to do it by hand but it's going to take a while. I need to change it on Pages and Posts in Welsh and English - so a command would be handy. I'm off to search Google now but maybe someone here is quicker. Thanks everyone, Gareth
LosOjos Posted September 8, 2014 Posted September 8, 2014 Backup your DB before continuing! Login to your Wordpress DB, then run the following SQL query (all posts and pages are stored in the wp_posts table on a standard WP installation): UPDATE wp_posts SET post_content = REPLACE(post_content, 'Ysgol Gyfun Gwyr', 'Ysgol Gyfun Gŵyr'); Funnily enough I had to do this myself over the weekend to update my own WP site!
chris_uk Posted September 8, 2014 Posted September 8, 2014 Try this, UPDATE 'TABLE_NAME' SET 'field' = REPLACE('field', 'Ysgol Gyfun Gwyr', 'Ysgol Gyfun Gŵyr')
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now