If your local IP address changes, then you may not be able to access your local WordPress admin on your local LAMP server. You can’t log in to your WordPress admin because it keeps redirecting you to the old IP address which is no longer valid.
To fix this, you need to update the “siteurl” and “home” settings in the WordPress database with your new local IP address.
You can do this in phpMyAdmin, or you can do it quicker in the terminal. Here’s how to do it in the terminal.
Ctrl + Alt + T
to open a terminal.- Log in to MySQL:
mysql -u root -p
You’ll be promted to enter your MySQL password. This is the password which you set when you set up MySQL on your local machine.
- Access your WordPress database. Change “wordpress” to the name of your own local WordPress database. If you don’t know the name, you can get it from your wp-config.php file.
use wordpress;
- Update the “siteurl” and “home” values with the new IP address. On the line below, change “192.168.1.1” to your NEW IP address, and change “OLD.IP.ADDRESS” to your OLD IP address.
UPDATE wp_options SET option_value = "http://192.168.1.1" WHERE option_value = 'http://OLD.IP.ADDRESS';
- Exit MySQL, then exit the terminal:
exit exit
Now, you should be able to access your local WordPress site at your new IP address.
Francisco
October 23rd, 2016 at 2:56 pm
Thanks for sharing this. I searched everywhere and other solutions were very long. This solution takes 2 minutes and it works. Very amazing. Muchas gracias.
zgh149
December 21st, 2016 at 1:54 am
Thx for your article, it save me a lot of time.
Bogdan
March 11th, 2017 at 3:09 pm
Many, many thanks – your solution works perfectly!
ARDupuis
April 7th, 2017 at 8:55 pm
My Raspberry Pi suffered through several power outages this morning and, as a result, its IP address changed. I guess it was bound to happen. Your solution was VERY useful and saved me a lot of time.
THANK YOU!!
Robert
June 8th, 2018 at 7:49 pm
Thank you very much! Works like a charm! I’ve spend two days trying to fix my WP and your guide help me to fix it in secods. Thank you so much!
suresh
June 28th, 2018 at 1:06 am
Hi thank you so much, its worked
Christopher de Vidal
June 28th, 2018 at 10:45 am
I couldn’t get this to work. I found that my setup used http://localhost/blog, so I learned two things: 1.) The old IP could be ‘localhost’ 2.) I needed to add /blog at the end of the new IP for this to work.
Christopher de Vidal
June 28th, 2018 at 10:47 am
And I found what to put for the old value with this:L
Nelson Rivera Ortiz
November 16th, 2018 at 5:14 am
Gracias.
matt
November 3rd, 2019 at 12:55 pm
Thanks for this article, exactly what I needed!
Burton
December 12th, 2020 at 4:07 pm
Now that is the solution — I’ve had to do the same thing several times several ways before I got around to setting up a fixed ip address the right way on the router, and this was by far the quickest way of all to change the ip address in wordpress.
Good thing I already had the fixed ip address setup before I found this method. It is so quick and simple that I would probably have put off messing with the router even longer :)!
Jamey S
March 17th, 2021 at 4:56 pm
Thank You !! Made it simple and fast.
Adwaith
June 17th, 2021 at 6:04 am
Thank you so much. This saved my weeks efforts
Martijn de Jong
October 12th, 2021 at 12:14 pm
Thank you for sharing this wonderful solution
Unfortunately the localhost address 192.198.1.1 did not work with my Pi so I used 127.0.0.1 instead and that worked fine.
So my querry looked like this:
MariaDB [wordpress]> UPDATE wp_options SET option_value = “http://127.0.0.1” Where option_value = ‘http://OLD.ADDRESS.IP.NUMBER’;
If you already used the query with 192.168.1.1, you have to fill in that IP for the OLD.ADDRESS.IP.NUMBER
Ethan C
March 2nd, 2022 at 10:42 pm
Thank you for sharing this. This is what I ended up using, which worked well for me: