Question
How run two or more SQL queries together in the same line command?
Hello!
I want run multiple queries (sql) in the same line command to Update image URLs in my database of WordPress.
How I run that command connecting the comands of updates?
For example:
UPDATE wpposts SET postcontent = replace(postcontent, ’http://oldurl.com/image/image1.jpg’, http://newurl.com/image/image1.jpg’);
UPDATE wpposts SET postcontent = replace(postcontent, ’http://oldurl.com/image/image2.jpg’, http://newurl.com/image/image2.jpg’);
UPDATE wpposts SET postcontent = replace(post_content, ’http://oldurl.com/image/image3.jpg’, http://newurl.com/image/image3.jpg’);
I am using nginx - Ubuntu 14.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
What do you mean?
Hi, you almost never run one query for each row.
What you want to do here is to replace the oldurl with newurl…
First make a copy of your database, then afterwards you can try these:
https://stanhub.com/change-all-wordpress-site-urls-in-mysql-database-tables-phpmyadmin/
After you have done it I think you also may have to change permalink back to default to make it rewrite settings for permalinks.