MySQL UPDATE to replace text in LONGTEXT field I have a WordPress table wp_posts and I'd like to run an UPDATE that will replace a url from my old domain to my new domain.

For example, let's say that one record in the field post_content has the following content:

This is my &lt;a href="http://www.my-old-site.com/link/to/some/page"&gt;old web&lt;/a&gt; site.
&lt;img src="http://www.my-old-site.com/wp-content/upload/2012/02/my-image-file.jps /&gt;


I'd like that to become:

This is my &lt;a href="http://www.my-new-site.com/link/to/some/page"&gt;old web&lt;/a&gt; site.
&lt;img src="http://www.my-new-site.com/wp-content/upload/2012/02/my-image-file.jps /&gt;


I've tried the following query

UPDATE wp_posts AS w` 
SET w.post_content = REPLACE(w.post_content, 'my-old-site.com', 'my-new-site.com');


but I don't get any result.

Any idea how to fix it?
There is an error in your query near 

AS w`


Alias name "w" should instead be 

`w`


Try this:

UPDATE wp_posts AS `w` 
SET w.post_content = REPLACE(w.post_content, 'my-old-site.com', 'my-new-site.com');