I use a free WordPress plugin, Duplicator, for cloning my live site for testing purposes. It'll backup the entire mysite1.com directory structure (you can exclude whatever dirs/files that you want) and it'll backup the entire database, too.
Unfortunately it doesn't allow for backup/restore of only certain database tables. It handles the search/replace of your database, i.e., any hard-links. So you run Duplicator from your site1.com admin, download/upload the backup created by Duplicator to your new (must be empty) folder for mysite2.com. Or, you could use SSH to do the copy much faster than downloading it to your computer then uploading it to the new dir.
Once you've got the backup to your desired folder, just go to mysite2.com/installer.php
and Duplicator prompts you for the new database details (remember, Duplicator needs a blank db to restore to, or you can force it to overwrite an existing db).
It's actually simpler than it sounds.
Edit: You didn't mention if your hosting allows you to point different domains to different directories. If it doesn't, let me know. It's easy via .htaccess to handle the redirects. I use GoDaddy's Economy plan, which allows unlimited domain addons but they all point to root. I use .htaccess to point all of my different domains to their respective directories.
Here's a step-by-step:
- if using a caching plugin, clear the cache and turn it off during the backup
- backup with Duplicator
if using SSH, copy (or move) the following two files:
site1.com/wp-snapshots/xxxxxxx_package.zip
site1.com/wp-snapshots/xxxxxxx_installer.php (rename to installer.php in destination directory)
to your site2.com root directory, e.g., public_html/site2/. Duplicator also creates a standalone MySQL backup file, but you can ignore it since the database is also saved in package.zip
- If not using SSH, you can move the above files via FTP, or download via Duplicator's interface the package.zip & installer.php to your computer and upload via FTP.
- in your browser, go to site2.com/installer.php
- a Duplicator form will appear. Leave the 'Settings' section as is
- enter your new database details (click 'Test Connection' if desired)
- checkmark 'I have read...' and click 'Install'
- follow the simple directions on the page that appears and you're done!
Duplicator takes care of the WP backend stuff like changing the site url in admin, fixing any hard-coded links that point to site1.com in your database, etc. It reminds you to clear your cache if you're using a caching plugin.