I retrieved this information from Wordpress.org and StackOverflow.
So, if you're like me, you started out with a Wordpress.com version of your blog. Then you moved to your own hosted WordPress installation. Now, you are ready to start messing with themes. So you have probably copied your WordPress files and your database over to your local machine. Now you're trying to log into the wp-admin
page but you're being redirected to your live WordPress installation rather than your local one. You just need to change the siteurl
in the local WordPress database. Here's what you do:
#####1. Login to your local MySQL.
mysql -u username -p
#####2. Use the WordPress Database.
use wordpress;
#####3. Check the current value of siteurl
.
select * from wp_options where option_name = 'siteurl';
You should see something like this:
+-----------+-------------+---------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+---------------------+----------+
| 1 | siteurl | http://yourblog.com | yes |
+-----------+-------------+---------------------+----------+
#####4. Update the value of siteurl
.
update wp_options SET option_value = 'http://localhost:8000' WHERE option_name = 'siteurl';
Now if you check the new value of siteurl
, you should see something like this:
+-----------+-------------+-----------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------+-----------------------+----------+
| 1 | siteurl | http://localhost:8000 | yes |
+-----------+-------------+-----------------------+----------+