I made a mistake when configuring a WordPress url and could no longer access the site to rectify the issue!
If you are as dumb as I was and need to change the url when you can’t access the WordPress admin panel you can follow these instructions if you have access to the database.
Login over ssh or access the Terminal and login to mysql using your username and password.
mysql -u dbuser -p
Enter password when prompted then select your wordpress database by name. (Yours may be named differently)
mysql> use wordpress;
You can then show all the tables if you wish.
mysql> show tables;
We need to select the 2 url entries from the database and change them to what we want.
if you know the value that is currently being used you can search for that value. (Change the url for yours)
mysql> select * from wp_options where option_value = 'http://wrongvalue.co.uk';
If not you can search by LIKE
mysql> select * from wp_options where option_value LIKE 'http://wrongvalue.co.uk';
Here you can make sure this is the correct entry you wish to change.
Then use the option id of the column you need to change like this.
mysql> update wp_options set option_value = 'http://correctvalue.co.uk' where option_id = 1;
Make sure you do this for both entries and you’re all done.