There have been many posts on this subject and there are lots of plugins to help you do this. I personally use Backup Buddy to migrate sites, especially if I want to migrate a site in or out of a multisite install (check out my previous walk through on how to do this).
But sometimes you do not want to go through the hassle of installing plugins. Maybe you just want to login to your web server, zip up your WordPress folder, script your entire DB and do it all manually. If you know how, this can be a really simple process.
Or perhaps you just want to change the URL of your site – you want to keep it hosted on the same server, but you just want to change the url, for example, from http://www.mysite.com to http://mysite.com/wp/ .
These are the SQL commands I run to make this change:
/* update all post permalinks */
set guid = REPLACE(guid, 'http://oldurl.com', 'http://www.newurl.net')
where guid LIKE '%http://oldurl.com%';
/* update all post content */
SET post_content = REPLACE(post_content, 'http://oldurl.com', 'http://www.newurl.net')
where post_content LIKE '%http://oldurl.com%';
/* update all post meta */
SET meta_value = REPLACE(meta_value, 'http://oldurl.com', 'http://www.newurl.net')
where meta_value LIKE '%http://oldurl.com%';
/* update all options */
set option_value = REPLACE(option_value, 'http://oldurl.com', 'http://www.newurl.net')
where option_value LIKE '%http://oldurl.com%';
Obviously, this will change from site to site and it depends on the table prefix your WordPress install is using and the urls.
So I created the WordPress Site URL Migration Generator to help you generate the SQL code really, really quickly. Just plug in the old url, the new url and your WordPress table name prefix. Check it out and let me know if there is anything missing or incorrect. Or drop me a line if it helped you in any way.