How to Change WordPress Website URL
In this article we show you how to easily change your WordPress URL or domain easily via the WP CLI.
First you need to decide what your new domain/Url is and know what the old one is. In this example we are changing the URL from “https://example.com” to “https://www.example.com” which is pretty common for people setting up CloudFlare CNAME method CDN for their website through a webhost.
Now that we know what we want to change from to its a matter of logging into the server via SSH and changing into the document root of the WordPress install. If you do not have an SSH terminal hop over to over to our Download page and get the access to one of the best SSH terminals ever with many time saving features and WordPress administration built right in.
Typically for your primary domain this would be done like the below. This will put you into your home directory public_html folder which is the most common spot for the primary domain or website installation.
Once inside the document root you will want to check the WP CLI is working before proceeding. This can be done by using the command below which gets your current site url via wp option get: wp option get siteurl
cd ${HOME}/public_html
If successful it should look something like the below.
[username@cpanel example.com]$ wp option get siteurl ; https://example.com [username@cpanel example.com]$
If you do not see the wp cli working you will need to install the WP CLI on the server or account or contact your hosting provider to request they install it for you.
We can now proceed to changing the URL.
Overview of the Process
Check current site url and home and dry run search and replace.
This method ensures all the urls end up with the https:// variant and finds and replaces all occurences.
Change the variables to meet your needs. The –dry run flag is used so you can test first to see what tables would have changes. The –skip-columns=guid is there as advised by WordPress.
OLD_Domain="olddomain.tld" ; NEW_Domain="newdomain.tld"; wp option get home ; wp option get siteurl ; wp search-replace "${OLD_Domain}" "${NEW_Domain}" --skip-columns=guid --dry-run ; wp search-replace "http://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid --dry-run ; wp search-replace "https://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid --dry-run ;
For those would prefer pasting it all on one line copy the below to notepad and edit the two variables before pasting it into the terminal.
OLD_Domain="olddomain.tld"; NEW_Domain="www.newdomain.tld"; wp option get home ; wp option get siteurl ; wp search-replace "${OLD_Domain}" "${NEW_Domain}" --skip-columns=guid --dry-run ; wp search-replace "http://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid --dry-run ; wp search-replace "https://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid --dry-run ;
Example Dry Run:
[username@cpanel example.com]$ OLD_Domain="olddomain.tld"; NEW_Domain="www.newdomain.tld"; wp option get home ; wp option get siteurl ; wp search-replace "${OLD_Domain}" "${NEW_Domain}" --skip-columns=guid --dry-run ; wp search-replace "http://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid --dry-run ; wp search-replace "https://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid --dry-run ; https://example.com https://example.com +--------------------+-----------------------+--------------+------+ | Table | Column | Replacements | Type | +--------------------+-----------------------+--------------+------+ | wpuf_commentmeta | meta_key | 0 | SQL | | wpuf_commentmeta | meta_value | 0 | SQL | | wpuf_comments | comment_author | 0 | SQL | | wpuf_comments | comment_author_email | 0 | SQL | | wpuf_comments | comment_author_url | 0 | SQL | | wpuf_comments | comment_author_IP | 0 | SQL | | wpuf_comments | comment_content | 0 | SQL | | wpuf_comments | comment_approved | 0 | SQL | | wpuf_comments | comment_agent | 0 | SQL | | wpuf_comments | comment_type | 0 | SQL | | wpuf_links | link_url | 0 | SQL | | wpuf_links | link_name | 0 | SQL | | wpuf_links | link_image | 0 | SQL | | wpuf_links | link_target | 0 | SQL | | wpuf_links | link_description | 0 | SQL | | wpuf_links | link_visible | 0 | SQL | | wpuf_links | link_rel | 0 | SQL | | wpuf_links | link_notes | 0 | SQL | | wpuf_links | link_rss | 0 | SQL | | wpuf_options | option_name | 0 | SQL | | wpuf_options | option_value | 7 | PHP | | wpuf_options | autoload | 0 | SQL | | wpuf_postmeta | meta_key | 0 | SQL | | wpuf_postmeta | meta_value | 6 | PHP | | wpuf_posts | post_content | 7 | SQL | | wpuf_posts | post_title | 1 | SQL | | wpuf_posts | post_excerpt | 0 | SQL | | wpuf_posts | post_status | 0 | SQL | | wpuf_posts | comment_status | 0 | SQL | | wpuf_posts | ping_status | 0 | SQL | | wpuf_posts | post_password | 0 | SQL | | wpuf_posts | post_name | 0 | SQL | | wpuf_posts | to_ping | 0 | SQL | | wpuf_posts | pinged | 0 | SQL | | wpuf_posts | post_content_filtered | 0 | SQL | | wpuf_posts | guid | 0 | SQL | | wpuf_posts | post_type | 0 | SQL | | wpuf_posts | post_mime_type | 0 | SQL | | wpuf_term_taxonomy | taxonomy | 0 | SQL | | wpuf_term_taxonomy | description | 0 | SQL | | wpuf_termmeta | meta_key | 0 | SQL | | wpuf_termmeta | meta_value | 0 | SQL | | wpuf_terms | name | 0 | SQL | | wpuf_terms | slug | 0 | SQL | | wpuf_usermeta | meta_key | 0 | SQL | | wpuf_usermeta | meta_value | 0 | PHP | | wpuf_users | user_login | 0 | SQL | | wpuf_users | user_nicename | 0 | SQL | | wpuf_users | user_email | 1 | SQL | | wpuf_users | user_url | 0 | SQL | | wpuf_users | user_activation_key | 0 | SQL | | wpuf_users | display_name | 0 | SQL | +--------------------+-----------------------+--------------+------+ Success: 22 replacements to be made. +--------------------+-----------------------+--------------+------+ | Table | Column | Replacements | Type | +--------------------+-----------------------+--------------+------+ | wpuf_commentmeta | meta_key | 0 | SQL | | wpuf_commentmeta | meta_value | 0 | SQL | | wpuf_comments | comment_author | 0 | SQL | | wpuf_comments | comment_author_email | 0 | SQL | | wpuf_comments | comment_author_url | 0 | SQL | | wpuf_comments | comment_author_IP | 0 | SQL | | wpuf_comments | comment_content | 0 | SQL | | wpuf_comments | comment_approved | 0 | SQL | | wpuf_comments | comment_agent | 0 | SQL | | wpuf_comments | comment_type | 0 | SQL | | wpuf_links | link_url | 0 | SQL | | wpuf_links | link_name | 0 | SQL | | wpuf_links | link_image | 0 | SQL | | wpuf_links | link_target | 0 | SQL | | wpuf_links | link_description | 0 | SQL | | wpuf_links | link_visible | 0 | SQL | | wpuf_links | link_rel | 0 | SQL | | wpuf_links | link_notes | 0 | SQL | | wpuf_links | link_rss | 0 | SQL | | wpuf_options | option_name | 0 | SQL | | wpuf_options | option_value | 0 | PHP | | wpuf_options | autoload | 0 | SQL | | wpuf_postmeta | meta_key | 0 | SQL | | wpuf_postmeta | meta_value | 0 | PHP | | wpuf_posts | post_content | 0 | SQL | | wpuf_posts | post_title | 0 | SQL | | wpuf_posts | post_excerpt | 0 | SQL | | wpuf_posts | post_status | 0 | SQL | | wpuf_posts | comment_status | 0 | SQL | | wpuf_posts | ping_status | 0 | SQL | | wpuf_posts | post_password | 0 | SQL | | wpuf_posts | post_name | 0 | SQL | | wpuf_posts | to_ping | 0 | SQL | | wpuf_posts | pinged | 0 | SQL | | wpuf_posts | post_content_filtered | 0 | SQL | | wpuf_posts | guid | 0 | SQL | | wpuf_posts | post_type | 0 | SQL | | wpuf_posts | post_mime_type | 0 | SQL | | wpuf_term_taxonomy | taxonomy | 0 | SQL | | wpuf_term_taxonomy | description | 0 | SQL | | wpuf_termmeta | meta_key | 0 | SQL | | wpuf_termmeta | meta_value | 0 | SQL | | wpuf_terms | name | 0 | SQL | | wpuf_terms | slug | 0 | SQL | | wpuf_usermeta | meta_key | 0 | SQL | | wpuf_usermeta | meta_value | 0 | PHP | | wpuf_users | user_login | 0 | SQL | | wpuf_users | user_nicename | 0 | SQL | | wpuf_users | user_email | 0 | SQL | | wpuf_users | user_url | 0 | SQL | | wpuf_users | user_activation_key | 0 | SQL | | wpuf_users | display_name | 0 | SQL | +--------------------+-----------------------+--------------+------+ Success: 0 replacements to be made. +--------------------+-----------------------+--------------+------+ | Table | Column | Replacements | Type | +--------------------+-----------------------+--------------+------+ | wpuf_commentmeta | meta_key | 0 | SQL | | wpuf_commentmeta | meta_value | 0 | SQL | | wpuf_comments | comment_author | 0 | SQL | | wpuf_comments | comment_author_email | 0 | SQL | | wpuf_comments | comment_author_url | 0 | SQL | | wpuf_comments | comment_author_IP | 0 | SQL | | wpuf_comments | comment_content | 0 | SQL | | wpuf_comments | comment_approved | 0 | SQL | | wpuf_comments | comment_agent | 0 | SQL | | wpuf_comments | comment_type | 0 | SQL | | wpuf_links | link_url | 0 | SQL | | wpuf_links | link_name | 0 | SQL | | wpuf_links | link_image | 0 | SQL | | wpuf_links | link_target | 0 | SQL | | wpuf_links | link_description | 0 | SQL | | wpuf_links | link_visible | 0 | SQL | | wpuf_links | link_rel | 0 | SQL | | wpuf_links | link_notes | 0 | SQL | | wpuf_links | link_rss | 0 | SQL | | wpuf_options | option_name | 0 | SQL | | wpuf_options | option_value | 4 | PHP | | wpuf_options | autoload | 0 | SQL | | wpuf_postmeta | meta_key | 0 | SQL | | wpuf_postmeta | meta_value | 2 | PHP | | wpuf_posts | post_content | 6 | SQL | | wpuf_posts | post_title | 0 | SQL | | wpuf_posts | post_excerpt | 0 | SQL | | wpuf_posts | post_status | 0 | SQL | | wpuf_posts | comment_status | 0 | SQL | | wpuf_posts | ping_status | 0 | SQL | | wpuf_posts | post_password | 0 | SQL | | wpuf_posts | post_name | 0 | SQL | | wpuf_posts | to_ping | 0 | SQL | | wpuf_posts | pinged | 0 | SQL | | wpuf_posts | post_content_filtered | 0 | SQL | | wpuf_posts | guid | 0 | SQL | | wpuf_posts | post_type | 0 | SQL | | wpuf_posts | post_mime_type | 0 | SQL | | wpuf_term_taxonomy | taxonomy | 0 | SQL | | wpuf_term_taxonomy | description | 0 | SQL | | wpuf_termmeta | meta_key | 0 | SQL | | wpuf_termmeta | meta_value | 0 | SQL | | wpuf_terms | name | 0 | SQL | | wpuf_terms | slug | 0 | SQL | | wpuf_usermeta | meta_key | 0 | SQL | | wpuf_usermeta | meta_value | 0 | PHP | | wpuf_users | user_login | 0 | SQL | | wpuf_users | user_nicename | 0 | SQL | | wpuf_users | user_email | 0 | SQL | | wpuf_users | user_url | 0 | SQL | | wpuf_users | user_activation_key | 0 | SQL | | wpuf_users | display_name | 0 | SQL | +--------------------+-----------------------+--------------+------+ Success: 12 replacements to be made. [username@cpanel example.com]$
Change the site URL if your satisfied with the results above.
Now we have checked and ensured we are changing what we want to change. The below command sequence will back up the current WordPress database before changing it and also spit out a premade command to restore the backup if things go wrong. Make sure to replace the placeholder values with the same ones as the above step before running.
The command sequence with stuff on multiple lines for readability. Backups up database to your home directory so its not publicly accessible. It then replaces all the occurrences in the database. It then flushes the cache and move the cache folder out of way for cache plugins which do not support wp cli. It then provides a pre-made command to restore the backup made prior in case you notice an issue and want to revert to before the change.
OLD_Domain="olddomain.tld"; NEW_Domain="www.newdomain.tld"; Today=$(date +"%Y-%m-%d"); WordPressDomain=$(wp option get siteurl| sed -e 's/^http\(\|s\):\/\///g' -e 's|^[^/]//||' -e 's|/.$||'); wp db export ${HOME}/${WordpressDomain}_db_backup-${Today}.sql ; ls -lah ${HOME}/${WordpressDomain}_db_backup-${Today}.sql ; wp search-replace "${OLD_Domain}" "${NEW_Domain}" --skip-columns=guid ; wp search-replace "http://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid ; wp search-replace "https://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid ; wp cache flush all; mv wp-content/cache wp-content/cache-bak ; echo "If there is an error you can revert with: 'wp db import ${HOME}/${WordpressDomain}_db_backup-${Today}.sql'"
All on one line for those who prefer that.
OLD_Domain="olddomain.tld"; NEW_Domain="www.newdomain.tld"; Today=$(date +"%Y-%m-%d"); WordPressDomain=$(wp option get siteurl| sed -e 's/^http\(\|s\):\/\///g' -e 's|^[^/]//||' -e 's|/.$||'); wp db export ${HOME}/${WordpressDomain}_db_backup-${Today}.sql ; ls -lah ${HOME}/${WordpressDomain}_db_backup-${Today}.sql; wp search-replace "${OLD_Domain}" "${NEW_Domain}" --skip-columns=guid ; wp search-replace "http://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid ; wp search-replace "https://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid ; wp cache flush all; mv wp-content/cache wp-content/cache-bak ; echo "If there is an error you can revert with: 'wp db import ${HOME}/${WordpressDomain}_db_backup-${Today}.sql'"
Example of backing up and changing the url:
[username@cpanel example.com]$ OLD_Domain="olddomain.tld"; NEW_Domain="www.newdomain.tld"; Today=$(date +"%Y-%m-%d"); WordPressDomain=$(wp option get siteurl| sed -e 's/^http\(\|s\):\/\///g' -e 's|^[^/]//||' -e 's|/.$||'); wp db export ${HOME}/${WordpressDomain}_db_backup-${Today}.sql ; ls -lah ${HOME}/${WordpressDomain}_db_backup-${Today}.sql; wp search-replace "${OLD_Domain}" "${NEW_Domain}" --skip-columns=guid ; wp search-replace "http://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid ; wp search-replace "https://${OLD_Domain}" "https://${NEW_Domain}" --skip-columns=guid ; wp cache flush all; mv wp-content/cache wp-content/cache-bak ; echo "If there is an error you can revert with: 'wp db import ${HOME}/${WordpressDomain}_db_backup-${Today}.sql'" Success: Exported to '/home/username/example.com_db_backup-2020-10-29.sql'. -rw-rw-r-- 1 username username 2.5M Oct 29 08:50 /home/username/example.com_db_backup-2020-10-29.sql Success: Updated 'home' option. Success: Updated 'siteurl' option. +--------------------+-----------------------+--------------+------+ | Table | Column | Replacements | Type | +--------------------+-----------------------+--------------+------+ | wpuf_commentmeta | meta_key | 0 | SQL | | wpuf_commentmeta | meta_value | 0 | SQL | | wpuf_comments | comment_author | 0 | SQL | | wpuf_comments | comment_author_email | 0 | SQL | | wpuf_comments | comment_author_url | 0 | SQL | | wpuf_comments | comment_author_IP | 0 | SQL | | wpuf_comments | comment_content | 0 | SQL | | wpuf_comments | comment_approved | 0 | SQL | | wpuf_comments | comment_agent | 0 | SQL | | wpuf_comments | comment_type | 0 | SQL | | wpuf_links | link_url | 0 | SQL | | wpuf_links | link_name | 0 | SQL | | wpuf_links | link_image | 0 | SQL | | wpuf_links | link_target | 0 | SQL | | wpuf_links | link_description | 0 | SQL | | wpuf_links | link_visible | 0 | SQL | | wpuf_links | link_rel | 0 | SQL | | wpuf_links | link_notes | 0 | SQL | | wpuf_links | link_rss | 0 | SQL | | wpuf_options | option_name | 0 | SQL | | wpuf_options | option_value | 7 | PHP | | wpuf_options | autoload | 0 | SQL | | wpuf_postmeta | meta_key | 0 | SQL | | wpuf_postmeta | meta_value | 6 | PHP | | wpuf_posts | post_content | 7 | SQL | | wpuf_posts | post_title | 1 | SQL | | wpuf_posts | post_excerpt | 0 | SQL | | wpuf_posts | post_status | 0 | SQL | | wpuf_posts | comment_status | 0 | SQL | | wpuf_posts | ping_status | 0 | SQL | | wpuf_posts | post_password | 0 | SQL | | wpuf_posts | post_name | 0 | SQL | | wpuf_posts | to_ping | 0 | SQL | | wpuf_posts | pinged | 0 | SQL | | wpuf_posts | post_content_filtered | 0 | SQL | | wpuf_posts | guid | 0 | SQL | | wpuf_posts | post_type | 0 | SQL | | wpuf_posts | post_mime_type | 0 | SQL | | wpuf_term_taxonomy | taxonomy | 0 | SQL | | wpuf_term_taxonomy | description | 0 | SQL | | wpuf_termmeta | meta_key | 0 | SQL | | wpuf_termmeta | meta_value | 0 | SQL | | wpuf_terms | name | 0 | SQL | | wpuf_terms | slug | 0 | SQL | | wpuf_usermeta | meta_key | 0 | SQL | | wpuf_usermeta | meta_value | 0 | PHP | | wpuf_users | user_login | 0 | SQL | | wpuf_users | user_nicename | 0 | SQL | | wpuf_users | user_email | 1 | SQL | | wpuf_users | user_url | 0 | SQL | | wpuf_users | user_activation_key | 0 | SQL | | wpuf_users | display_name | 0 | SQL | +--------------------+-----------------------+--------------+------+ Success: Made 22 replacements. +--------------------+-----------------------+--------------+------+ | Table | Column | Replacements | Type | +--------------------+-----------------------+--------------+------+ | wpuf_commentmeta | meta_key | 0 | SQL | | wpuf_commentmeta | meta_value | 0 | SQL | | wpuf_comments | comment_author | 0 | SQL | | wpuf_comments | comment_author_email | 0 | SQL | | wpuf_comments | comment_author_url | 0 | SQL | | wpuf_comments | comment_author_IP | 0 | SQL | | wpuf_comments | comment_content | 0 | SQL | | wpuf_comments | comment_approved | 0 | SQL | | wpuf_comments | comment_agent | 0 | SQL | | wpuf_comments | comment_type | 0 | SQL | | wpuf_links | link_url | 0 | SQL | | wpuf_links | link_name | 0 | SQL | | wpuf_links | link_image | 0 | SQL | | wpuf_links | link_target | 0 | SQL | | wpuf_links | link_description | 0 | SQL | | wpuf_links | link_visible | 0 | SQL | | wpuf_links | link_rel | 0 | SQL | | wpuf_links | link_notes | 0 | SQL | | wpuf_links | link_rss | 0 | SQL | | wpuf_options | option_name | 0 | SQL | | wpuf_options | option_value | 0 | PHP | | wpuf_options | autoload | 0 | SQL | | wpuf_postmeta | meta_key | 0 | SQL | | wpuf_postmeta | meta_value | 0 | PHP | | wpuf_posts | post_content | 0 | SQL | | wpuf_posts | post_title | 0 | SQL | | wpuf_posts | post_excerpt | 0 | SQL | | wpuf_posts | post_status | 0 | SQL | | wpuf_posts | comment_status | 0 | SQL | | wpuf_posts | ping_status | 0 | SQL | | wpuf_posts | post_password | 0 | SQL | | wpuf_posts | post_name | 0 | SQL | | wpuf_posts | to_ping | 0 | SQL | | wpuf_posts | pinged | 0 | SQL | | wpuf_posts | post_content_filtered | 0 | SQL | | wpuf_posts | guid | 0 | SQL | | wpuf_posts | post_type | 0 | SQL | | wpuf_posts | post_mime_type | 0 | SQL | | wpuf_term_taxonomy | taxonomy | 0 | SQL | | wpuf_term_taxonomy | description | 0 | SQL | | wpuf_termmeta | meta_key | 0 | SQL | | wpuf_termmeta | meta_value | 0 | SQL | | wpuf_terms | name | 0 | SQL | | wpuf_terms | slug | 0 | SQL | | wpuf_usermeta | meta_key | 0 | SQL | | wpuf_usermeta | meta_value | 0 | PHP | | wpuf_users | user_login | 0 | SQL | | wpuf_users | user_nicename | 0 | SQL | | wpuf_users | user_email | 0 | SQL | | wpuf_users | user_url | 0 | SQL | | wpuf_users | user_activation_key | 0 | SQL | | wpuf_users | display_name | 0 | SQL | +--------------------+-----------------------+--------------+------+ Success: Made 0 replacements. +--------------------+-----------------------+--------------+------+ | Table | Column | Replacements | Type | +--------------------+-----------------------+--------------+------+ | wpuf_commentmeta | meta_key | 0 | SQL | | wpuf_commentmeta | meta_value | 0 | SQL | | wpuf_comments | comment_author | 0 | SQL | | wpuf_comments | comment_author_email | 0 | SQL | | wpuf_comments | comment_author_url | 0 | SQL | | wpuf_comments | comment_author_IP | 0 | SQL | | wpuf_comments | comment_content | 0 | SQL | | wpuf_comments | comment_approved | 0 | SQL | | wpuf_comments | comment_agent | 0 | SQL | | wpuf_comments | comment_type | 0 | SQL | | wpuf_links | link_url | 0 | SQL | | wpuf_links | link_name | 0 | SQL | | wpuf_links | link_image | 0 | SQL | | wpuf_links | link_target | 0 | SQL | | wpuf_links | link_description | 0 | SQL | | wpuf_links | link_visible | 0 | SQL | | wpuf_links | link_rel | 0 | SQL | | wpuf_links | link_notes | 0 | SQL | | wpuf_links | link_rss | 0 | SQL | | wpuf_options | option_name | 0 | SQL | | wpuf_options | option_value | 0 | PHP | | wpuf_options | autoload | 0 | SQL | | wpuf_postmeta | meta_key | 0 | SQL | | wpuf_postmeta | meta_value | 0 | PHP | | wpuf_posts | post_content | 0 | SQL | | wpuf_posts | post_title | 0 | SQL | | wpuf_posts | post_excerpt | 0 | SQL | | wpuf_posts | post_status | 0 | SQL | | wpuf_posts | comment_status | 0 | SQL | | wpuf_posts | ping_status | 0 | SQL | | wpuf_posts | post_password | 0 | SQL | | wpuf_posts | post_name | 0 | SQL | | wpuf_posts | to_ping | 0 | SQL | | wpuf_posts | pinged | 0 | SQL | | wpuf_posts | post_content_filtered | 0 | SQL | | wpuf_posts | guid | 0 | SQL | | wpuf_posts | post_type | 0 | SQL | | wpuf_posts | post_mime_type | 0 | SQL | | wpuf_term_taxonomy | taxonomy | 0 | SQL | | wpuf_term_taxonomy | description | 0 | SQL | | wpuf_termmeta | meta_key | 0 | SQL | | wpuf_termmeta | meta_value | 0 | SQL | | wpuf_terms | name | 0 | SQL | | wpuf_terms | slug | 0 | SQL | | wpuf_usermeta | meta_key | 0 | SQL | | wpuf_usermeta | meta_value | 0 | PHP | | wpuf_users | user_login | 0 | SQL | | wpuf_users | user_nicename | 0 | SQL | | wpuf_users | user_email | 0 | SQL | | wpuf_users | user_url | 0 | SQL | | wpuf_users | user_activation_key | 0 | SQL | | wpuf_users | display_name | 0 | SQL | +--------------------+-----------------------+--------------+------+ Success: Made 0 replacements. Success: The cache was flushed. mv: cannot stat 'wp-content/cache': No such file or directory If there is an error you can revert with: 'wp db import /home/username/example.com_db_backup-2020-10-29.sql' [username@cpanel example.com]$
Hopefully now you have completed changing your WordPress url in an easy manner without needing plugins or having to craft custom queries in phpmyAdmin to fix up your posts.
Follow us for more articles and definitely checkout our WizardAssistant App which provides an easy to use interface for working on your WordPress sites and servers via SSH with built in WP CLI support.