2

I have multiple MySQL databases(50+) and I want to replace a string in all of them, is there anyway to search and replace in all the databases?

Server is CentOS and I have SSH root access.

0

Not really.

Instead, you could do something like

SELECT CONCAT("UPDATE ", table_schema, ".", table_name, 
                " SET foo = replace(foo, 'this', 'that');")
    FROM information_schema.tables
    WHERE ...

to generate the desired 50+ UPDATE statements. Then copy and paste them into the mysql commandline tool.

(Or you could construct a shell script using that. Or...)

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.