The following tutorial is helpful if you have a MySQL database and need to find and replace all occurrences of a string, for example, replacing “www.YourOldDomain.com” with “www.YourNewDomain.com”. This is useful if you are moving or cloning your website to another domain, especially if you are using software such as WordPress.
First, go to your old domain name and export the ENTIRE database, including enabling the option to “drop tables” if they’re already present. If you’re using PHPMyAdmin, you’ll want to select the option as highlighted below. To see these options, choose the Export Method: Custom – display all possible options.
Once you’ve obtained your .sql file, open it up in a text editor like Notepad, and do a find-and-replace of the string that you’re looking for.
After which, the next step is to import the .sql file back into your MySQL database. The “drop tables” command will remove all the existing tables, and then import your data. You now have a database with all the occurrences of your text string properly replaced.
- How to find and replace a text string in all files on your cPanel / WHM / Linux / Unix server
- How To Create An Anonymous or Limited Access Only Account With MySQL
- How To Reset The MySQL Root User Password and Privileges
- Formatting a Decimal Number to 2 Decimal Places in Java or JSP
- How to redirect one domain to other domain with all query string variables (htaccess)