ghost: db password reset (mysql setup)

ghost: db password reset (mysql setup)

ghost: db password reset (mysql setup)
Photo by benjamin lehman / Unsplash

In this instance you have lost your password to your ghost blog, and now are locked out.

  • Please note - if you attempt to access the ghost blog database via phpsqladmin the user database will not be visible - it needs to be done through the mysql prompt.
  • To reset a sqlite password check here

Here is how to reset it.

mysql -u root -p -h <your mysql ip>
  • In the instance where your mysql is inside a docker container you can get in this way. List your dockers and find your mysql instance
sudo docker ps -a

Once you have your mysql  name:

docker exec -it <container name> /bin/bash

You will see your prompt change as in:

mysql -u root -p

Typically mysql containers are usually always configured to accept a local bash login.

Two Parts Left:

  • Clearing your over logins
  • Resetting your password
  1. Clearing your over - logins by clearing your brute table.
select * from brute;
truncate table brute;

2. Resetting your password

See your current login:

select * from users;

Now create a new password at bcrypt:

And then use that hash to insert into the password field:

update users set password='$2y$10$aftddlNMgIvpwR4sjRiPdeSxXUCdQVBeBxkHfN2zUsT/FcXMkcx1y' where slug='mainuser'

Once that is done you will be able to login under the password 'bob' which you can then change.

No reboot of the container is even required.

Linux Rocks Every Day