Available only for:
- Self-hosted Bytebase version 3.22.0 and later
- Shell access to the host, or
kubectlaccess to the cluster, that runs Bytebase
bytebase recovery restores password sign-in from the command line. It opens an interactive menu with two actions, Enable password sign-in and Reset user password, and changes the metadata database directly, so it works while the console is unreachable.
Recovery requires downtime. If any Workspace Admin can still sign in, reset passwords, roles, and 2FA from the console instead.
Recovery actions and limits
Recovery can’t do the following:
- Create or reactivate a user: the target must be an existing, active user. Service accounts and workload identities are rejected.
- Change the role of a user who already has one: the command offers a role only when the user has no workspace role, whether direct, through a group, or through
allUsers. If no active Workspace Admin is left and every user already has a role, recovery can’t restore administrator access. - Reset two-factor authentication: only another Workspace Admin can reset a user’s 2FA.
- Bypass the workspace domain: when Members restriction is on, the user’s email must belong to an allowed workspace domain.
Run recovery
Runbytebase recovery from an interactive terminal, with the same Bytebase version and the same metadata configuration as the stopped server. Recovery doesn’t migrate the metadata schema, so the version must match exactly: never use a floating image tag such as latest.
- Docker
- Kubernetes
- Binary
The commands assume the container is named
bytebase. Substitute your own container name. Because the server container is stopped, recovery runs in a one-off container. Keep -it, because recovery only accepts input from a terminal.-
Check the version and the image before you stop the server:
If the version is older than 3.22.0, stop here and upgrade first. Use the printed image ID as
<image>in the next steps, so recovery and the restart run the exact image the server ran. -
Stop Bytebase:
- Back up the metadata: the data directory for embedded PostgreSQL, or the metadata database for external PostgreSQL.
-
Run recovery with the same flags the server uses to reach its metadata. For embedded PostgreSQL, that is the data volume:
If the server passes
--data, mount that path instead and pass the same--dataafterrecovery. For external PostgreSQL, that isPG_URL:Add every other flag the server needs to reach PostgreSQL:--networkor--add-host, the--volumeof a connection-string file or TLS certificate, and the credential variables for IAM authentication. IfPG_URLis a file path, mount that file. -
After you exit the session, start Bytebase again on the same image. If your
docker runcommand uses a floating tag or--pull always, replace the image name with<image>and drop--pull always, so the restart doesn’t upgrade Bytebase.
Use the recovery session
The session shows a menu until you enterq, so you can run several actions in a row. The example resets a password:
- Enable password sign-in: switches off Disallow signin with email & password. The menu lists it first, but when no administrator knows a password, reset one first.
- Reset user password: enforces the workspace password restriction and clears the lockout from failed password attempts. It doesn’t change the user’s 2FA or SSO sign-in.
After recovery
- Open Bytebase and sign in with the email and password, then verify the account’s access.
- Repair and test the identity provider.
- Switch Disallow signin with email & password back on in Settings > General > Account if it was on before the outage.
- Review the recovery events in the audit log. Each action records a warning-level event whose method starts with
/bytebase.cli.Recovery/.
Troubleshooting
Terminal required
-it to docker run, kubectl run, or kubectl exec. On a host, run the command from an interactive shell, with ssh -t when you connect over SSH.
Data directory not accessible
--data path doesn’t exist where recovery runs. With a binary, pass the same --data as the server, as an absolute path. With Docker, mount the data volume at that path.
Embedded metadata database not initialized
PG_URL isn’t set. The data directory exists, but it isn’t the one the server uses. With Docker, the volume isn’t mounted or the host path is wrong. With a binary, --data is missing or wrong. If the server uses external PostgreSQL, pass PG_URL instead.
Embedded metadata database not readable
External metadata database not connected
PG_URL is set, and the text after the last colon names the cause. Recovery needs everything the server uses to reach PostgreSQL: the network (--network or --add-host with Docker), a mounted connection-string file when the cause is failed to read database URL from file, TLS files, or IAM credentials.

