How to reset user password Ghost 2 blog MySQL
If you forgot your Ghost blog password and you don't have configured mail then you need to reset your password. The solution will be different for MySQL and SQLLite. In this blog post we will show how to reset the password for MySQL and Ghost 2.0. The process is simple:
Update 2019: If you have setup email recovery address which is failing then you can try to run:
ghost config
in the ghost folder and then try to reset your password by mail. Other wise you can follow the steps below. Another very informative place is:
Forgot All Credentials
Note: Use this ghost config as a last resort and do back of your configuration in order to restore it later!
Get ghost config password
- The first thing to try is to try to get your password by the following command:
ghost config get database.connection.password
Result will be your ghost password:
123456
Note: You need to run the command in your ghost installation folder otherwise you will get error:
Working directory is not a recognisable Ghost installation.
Please run `ghost config get` again within a folder where Ghost was installed with Ghost-CLI.
Reset ghost user password
If the above method is not working or you have encrypted password then you can try:
- First you need to find your configuration. Most probably this is file named: config.production.json
{
"url": "http://XXX.XXX.com",
"server": {
"port": 1236,
"host": "127.0.0.1"
},
"database": {
"client": "mysql",
"connection": {
"host": "localhost",
"user": "XXXXX",
"password": "XXXX",
"database": "xxx_xxx_com_prod"
}
},
"mail": {
you can find the connection information inside this file.
- Now you can start MySQL and reset the password with it. Start MySQL by:
mysql -u root -p
Now select the database and find the user record by
mysql> use my_ghost_base;
mysql> select * from users;
Now you can reset the password with:
ALTER USER 'ghost_user'@'localhost'KokoDinev90! IDENTIFIED WITH mysql_native_password BY '123456';
flush privileges;
quit
Note you can encrypt with with bcrypt from this site: A collection of password hashing tools
Or once you do the password reset and activation you can change the password from the UI.
- Unlock the user in case that is locked:
update users set status = “active” where name ='ghost_user_name';
- The final step is to restart ghost application by:
ghost restart
or by
ghost stop
ghost start
Finally you can check the status by
ghost status
Enjoy your new ghost blog password!
P.S. you can find more information for resetting MySQL 8 password on this link: MySQL 8 Set or reset user password