Conceptually, the approach is to create a new database identical to your existing WordPress database, and a new folder identical to your existing WordPress folder. But each with a different name, if you are doing this on the same domain.
Make sure your database has a new user name connected to the database with full access.
Then some small changes. Change wp-config.php, updating the database name, database user name and the database user name’s password. Change the wp_options table:
the WordPress Address and Blog Address are stored as siteurl and home (the option_name field). All you have to do is change the option_value field to the correct URL for the records with option_name=’siteurl‘ or option_name=’home‘.
You’ll also probably need to do these steps:
- If you are using Permalinks, go to the Administration > Settings > Permalinks panel and update your Permalink structure to your .htaccess file, which should be in the same directory as the main index.php file.
- If you have problems with missing images that you’ve uploaded, you need to change the path to the images on every post directly on your SQL database. For this, follow the instructions on Tamba2’s Tutorial “Moving your weblog inside your PC”.
- You must also check and edit ‘store uploads folder’ under Settings-Miscellaneous or all your new uploads will continue to go into the old folder.
- Existing image/media links uploaded media will refer to the old folder and must be updated with the new location.
Above quotes from Codex (Moving WordPress)