WordPress Change Domain inside DB using Shell / String Replace in All Occurrences
A simple Shell Script to Change all WordPress domain name OR String instances After the Find and Replace operation, it will be re-imported back to DB
- You will need shell access to your server
- Only works for linux based servers
- Domain Migration
- Update Existing Domain to HTTPS
- Find and Replace a string in the whole database
It keeps an archive file just in case
- It uses
mysqldump
command to export the database specified in the variables - Creates a
tar.gz
archive for the namedexported SQL
file - Then it performs a linux
SED
find and replace operation inside the SQL file - Then, it uses
mysqldump
to re-import the SQL file back into the database
sh wp_changedomain.sh