0

I have a site with a domain "mydomainA.com". I moved to a site "mydomainB.com". The problem: I have a lot of images in the pages that link to "mydomainA.com". I would like to save time and find a MySQL query that replaces all occurrences of a term ... by another to replace all occurrences of "mydomainA" by "mydomainB".

But is that really possible?

Otherwise, I would use php preg_replace edn.

Sincerely,

3 Answers 3

2
UPDATE links SET url = REPLACE( url, 'mydomainA.com', 'mydomainB.com' )

http://dev.mysql.com/doc/refman/5.6/en/string-functions.html#function_replace

Sign up to request clarification or add additional context in comments.

Comments

1

Syntax of replace is

UPDATE table1 SET field1 = REPLACE(field1,'value1','value2')
WHERE field1 LIKE '%value1%'

Check replace function here.

Here is an example

1 Comment

Thank you. With your example link, I can see the power of replace function.
1

Probably you are looking for the Replace MySQL command. Combined with an UPDATE just does its job.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.