How to perform a search and replace on an entire MySQL database
There are many guides on the internet on how to perform a search and replace on a MySQL database but these, almost without exception, limit the search and replace to an individual table within the database. Whilst useful, sometimes it is necessary and easier to search the entire database.
We come across this problem quite often when a WordPress web site is moved from the development server or an old URL, to the final URL.
We've tried many WordPress plugins but none have quite managed to do what we need and search the entire database.
We've found that the easiest way to perform a search is to export the SQL database, using MySQL, to a file and download it to your computer. Open the .sql file in Notepad / Text Editor and perform the search / replace there. Save the file and then import the updated file back into MySQL.
We now use this method all of the time and it's much easier, quicker and thorough.