In order to repair a certain site, I built a Wordpress environment with Docker and launched it with localhost: 8000, but the CSS was not reflected and I had to change siteurl
.
The README of the repository described the procedure to change using "sequel pro", but "sequel pro, problem of not being able to connect!" Occurred. .. .. (It seems that the authentication method has changed when I saw Gugu)
So instead of using sequencerpro, I decided to connect to Docker from the command and change siteurl
.
I rarely have the opportunity to touch this area, so I'd like to keep it as a memorandum!
sudo docker ps
When you execute the command, the container ID will be displayed, so check the container ID of the target DB described in docker-compose.yml
.
Then execute the following command
sudo docker exec -it {Container ID} /bin/bash
root @ container ID: / #
If a prompt like this is displayed, the connection is successful! is.
Check MYSQL_USER:
and MYSQL_DATABASE:
described in docker-compose.yml
and execute the following command.
mysql -u {Database username} -p {Database name}
Then you will be prompted to enter {database password}
, so enter the password listed in MYSQL_PASSWORD:
.
You can check the currently set seiteurl
and home
by executing the following command.
Only siteurl
should omit, "home"
. (And vice versa)
select * from wp_options where option_name in ("siteurl","home");
If you can confirm the current settings, change the settings.
update wp_options
set option_value="{Correct URL}"
where option_name in ("siteurl");
If you want to change both seiteurl
and home
, make the last description as where option_name in ("siteurl", "home");
.
Finally, make sure that you can change it properly and finish.
select * from wp_options where option_name in ("siteurl");
It is OK if the displayed siteurl
is updated!
Then, return to the TOP screen or management screen of the site and check that it is displayed properly.
Type exit
in the command to disconnect from the DB and docker connections respectively.
As mentioned above, the trouble that suddenly occurs ...! !! It was a workaround for: fearful :!
MySQL: When Sequel Pro cannot connect to MySQL How to restore when you accidentally change the site URL in WordPress general settings