[Error: file is not a database]

Apologies if the solution is buried somewhere in another thread, or post. I could not find anything specific to this. I’m getting [Error: file is not a database].

My scenario:

  1. Downloaded sqlcipher to a PopOS installation. (3.15.2 //sqlcipher --version)
  2. Was successful in creating a new encrypted database. Could open, close and see results.
  3. Downloaded that database fie to MacOS (Catalina). (3.31.0 //sqlcipher --version)
  4. I opened the database and entered the “PRAGMA key” statement as the first input. Confirmation: “ok”.
  5. However, anything I do after that results in [Error: file is not a database].
    Is this different versions that is causing the issue?
    Thanks,
    -Santosh

@thomassantosh

This discussion forum post should point you in the correct direction: Upgrading to SQLCipher 4

It sounds like your database was created using SQLCipher v3 and you’re attempting to open it using SQLCipher v4. To verify this assumption is correct, you can run PRAGMA cipher_version on each side.

Thanks. Yes, the different cipher versions was the issue. And the cipher_migrate command helped. I also just updated the Linux installation to 4.4. These instructions were super-helpful https://github.com/sqlitebrowser/sqlitebrowser/wiki/SQLCipher:-Build-from-Source-on-Debian-Stretch---Newbie-Instructions

@thomassantosh

Glad to hear you were able to resolve the issue.