Check and change WordPress site & home location using SQL

I tend to move around the WordPress sites, moving from one development server to another and moving between hosting companies.

The SQL-queries below, tend to be most useful when moving these installations between hosts and directories. They check, and set, where the WordPress installation directory is (siteurl) and what the home url should be (home).

First check.

SELECT * FROM wp_options WHERE option_name IN ('siteurl', 'home');

Then set it.

UPDATE wp_options SET option_value='http://www.mikaelroos.se/wordpress' WHERE option_name='siteurl';
UPDATE wp_options SET option_value='http://www.mikaelroos.se/' WHERE option_name='home';

I find it much easier doing this by SQL than using the admin interface.