以下是官方重置 root 密码文档,保存以备用:

How to reset your root password

Log into your server with root privileges. Then start a Ruby on Rails console.

Start the console with this command:

Wait until the console has loaded.

There are multiple ways to your user. You can search for email or username.

or

Now you can change your password:

It’s important that you change both password and password_confirmation to make it work.

Don’t forget to save the changes.

Exit the console and try to login with your new password.