Wordpress website URLs in admin need updating but locked out.

November 30, 2014 1.1k views

I changed my WP site url's in the admin to point to our domain instead of our IP. I do not have phpmyadmin to make the edit to set it back to our IP. How can I get this done? I have a meeting soon, and now I can't show my client their website. =(

1 Answer

You are correct that an update to your MySQL database is needed to correct this and without phpmyadmin you will need to use the command line mysql client. The steps to update the default address are:

1.) Log into your droplet via ssh and get your root mysql password from the file /root/.my.cnf

cat /root/.my.cnf

2.) Use the following command to connect to your MySQL server from the command line client, entering the MySQL root password when prompted

mysql -uroot -p wordpress

3.) Now you can update your database with the correct url using the following queries, replacint [your ip] with your droplet's IP address.

update wp_options set option_value = 'http://[your ip]' where option_name = 'siteurl';

update wp_options set option_value = 'http://[your ip]' where option_name = 'home';

Once you have done this your site should again be accessible.

Have another answer? Share your knowledge.