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 + Tto 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.
- 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:
Now, you should be able to access your local WordPress site at your new IP address.
See more: LAMP