Initialize User Password
If you forget the user password stored in the local database, it cannot be retrieved as it is encrypted using bcrypt
. However, you can reset it by creating a default user account and then updating the password to your preference.
Steps to Reset the Password
1. Stop the Dashboard Service
To ensure data consistency and prevent conflicts, it is recommended to stop the Dashboard before modifying the database.
2. Locate the Database File
The database file is typically located at:
/opt/nezha/dashboard/data/sqlite.db
3. Query and Reset the User Table
Use the SQLite command-line tool to interact with the database:
Query Existing Users: Run the following command to list all existing users:
bashsqlite3 /opt/nezha/dashboard/data/sqlite.db "SELECT * FROM users;"
Clear the User Table: If you need to reset the user table, run the following command to delete all user records:
bashsqlite3 /opt/nezha/dashboard/data/sqlite.db "DELETE FROM users;"
4. Restart the Dashboard
After modifying the database, restart the Dashboard to apply changes.
5. Login Using the Default Account
During initialization, the Dashboard checks if the user table is empty. If it is, a default user account is created automatically.
You can log in with the following credentials:
- Username:
admin
- Password:
admin
Post-Reset Actions
Once logged in, it is strongly recommended to change the default password immediately for security reasons:
- Go to Profile → Personal Info.
- Select Update Profile.
- Set a new, secure password.
Important Notes
- Backup Before Modifying: Always create a backup of the database before making any changes:bash
cp /opt/nezha/dashboard/data/sqlite.db /opt/nezha/dashboard/data/sqlite.db.bak
- Caution: Clearing the user table will remove all existing user accounts, including administrators. Proceed only if you are certain about the operation.