Redirecting DNS without breaking everything

1) You have to change all references of www.mydomain.com to mysite.com in WP. WP will only respond to the hostname/url that it was configured for. If you make a request with a different url, WP will respond with an error message. WP stores the url in two places wp-config.php and the database. In wp-config.php just do a manual search and replace. For the database one method to change site’s url – export the database, do a search and replace, then import (be sure to keep a copy of the original export as backup). There are also plugin that will do the search and replace for you.

2) DNS change. This depends on your DNS provider of www.mydomain.com. Some providers have the ability to add 301 redirects. See if your DNS provider has this capability. If not, you can add 301 redirects into your WP .htaccess near the top

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.mydomain.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301,NC]