Directly operate mariadb running in Docker container

I can't log in to Wordpress

I'm running Wordpress and I'm impatient because I can't log in as an administrator. Password reset didn't work either, so I decided to change the password by operating mariadb directly.

KUSANAGI RoD mairadb password

If you are building on Kusanagi Rod, the mariadb password can be found in .kusanagi.mysql.

bash:.kusanagi.mysql


MYSQL_ROOT_PASSWORD=wp_root_password          <--This!
MYSQL_DATABASE=wp_database
MYSQL_USER=wp_username
MYSQL_PASSWORD=wp_password
MYSQL_CHARSET=utf8mb4
#MYSQL_ALLOW_EMPTY_PASSWORD=
#MYSQL_RANDOM_ROOT_PASSWORD=
#SOCKET=
#MYSQL_INITDB_SKIP_TZINFO=
#MYSQL_ROOT_HOST=

Log in to mariadb in the Docker container

Log in to Docker mariadb with the docker command and then change your Wordpress password. The password is hashed with MD5 in the database, so change it using the MD5 command.

$ docker-compose exec db mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 8
Server version: 10.5.6-MariaDB-1:10.5.6+maria~focal mariadb.org binary distribution

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 
MariaDB [(none)]> use wp_database;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [wp_database]> 
MariaDB [wp_database]> select * from wp_users;
+----+------------+-----------+---------------+--------------+----------------------+---------------------+-----------------------------------------------+-------------+--------------+
| ID | user_login | user_pass    | user_nicename | user_email   | user_url      | user_registered     | user_activation_key                           | user_status | display_name |
+----+------------+-----------+---------------+--------------+----------------------+---------------------+-----------------------------------------------+-------------+--------------+
|  1 | admin      | md5_password | admin    | mail@ddress  | http://example.com | 2020-08-05 05:53:54 | ???? |           0 | admin   |
|  2 | user       | md5_password | user     | mail@ddress  |                    | 2020-08-05 06:30:29 | ???? |           0 | ????    |
+----+------------+-----------+---------------+--------------+----------------------+---------------------+-----------------------------------------------+-------------+--------------+
2 rows in set (0.023 sec)

MariaDB [wp_database]> 
MariaDB [wp_database]> update wp_users set user_pass=MD5('newpassword') where id=1;
Query OK, 1 row affected (0.034 sec)
Rows matched: 1  Changed: 1  Warnings: 0

It's OK if you can now log in to Wordpress.

Recommended Posts

Directly operate mariadb running in Docker container
Kind @ Mac in Docker and vctl container
MySQL container does not start in Docker
[Docker] Start container, start bash in container, delete image
Japanese setting of mysql in Docker container
Starting with installing Docker on EC2 and running Yellowfin in a container
How to check the logs in the Docker container
[Docker] Check the running container and enter there
Keep docker container running with no resident process running
How to update pre-built files in docker container
Edit Docker Container in VSCode multi-stage SSH Vagrant
Small Docker container
Docker in LXD
I tried running Ansible on a Docker container
How Docker works ~ Implement the container in 60 lines
Points stuck when running vite + Nginx in Docker environment
Launch MariaDB with Docker
Operate Emby with Docker
Docker container usage scene
Host specification when laravel php artisan serve in docker container
Nginx container that displays the Hostname of the host running Docker
Put Redmine docker container in Raspberry Pi 4 Model B 2GB
I tried running a Docker container on AWS IoT Greengrass 2.0