Diagnostics • Compatibility • Quick fixes

Fix “wrong key” error in DB Browser (SQLCipher)

“Wrong key” usually means the passphrase is incorrect or encryption parameters don’t match how the database was created. Follow this checklist to identify the cause and fix the issue safely.

Step‑by‑step diagnostics

  1. Confirm the passphrase — retype manually (avoid paste), check Caps Lock and keyboard layout, remove leading/trailing spaces.
  2. Check KDF iterations — ensure the same value used at creation; if unknown, try common values used in your stack before.
  3. Check page size — it must match the value used when the DB was created.
  4. Validate cipher/integrity options — ensure you’re opening the DB in SQLCipher mode with matching settings.
  5. Rule out corruption — test a backup or open on another machine/version; verify storage isn’t failing.
  6. Reopen after changes — close the DB and try again after each adjustment.
Need guidance on parameters? Start with SQLCipher basics and a clean test DB to confirm your defaults.

Fix by scenario

You know the correct passphrase

  • Try alternate iteration counts used in your environment.
  • Try the page size you usually set for new DBs.
  • Ensure SQLCipher mode is selected, not plain SQLite.

Walkthrough: Open an encrypted DB

Passphrase might be wrong

  • Confirm the exact passphrase used at creation time.
  • Check if a password manager auto‑filled the wrong entry.
  • Verify there are no invisible characters/spaces.

If you cannot recover it, consider restoring from a known‑good backup.

Prevent it next time

See also: Security best practices and Migrate to SQLCipher for standardization tips.

Next steps

Page last modified: --
|