SQL replace in the whole DB

  • On 28.04.2023

SELECT CONCAT(
‘update ‘, table_name ,
‘ set ‘, column_name, ‘ = replace(‘, column_name,’, ”www.oldDomain.example”, ”www.newDomain.example”);’
) AS statement
FROM information_schema.columns
WHERE table_schema = ‘dbname’ AND table_name LIKE ‘wp_%’;