When you run ".open test.db" if the database doesn't already exist, then the file is created. However *no data is written yet* as there are a few permanent things you could change at the very start (like page size, encoding, etc), so it holds off on writing the first page with the header until you issue some sort of statement that isn't setting those "new database options" So since the file is still 0 size at this point, there is no header for .dbinfo to read from. If you create a table first for example, then it will populate the header and actually write to the file, at which point there will be a header for .dbinfo to read.
From: sqlite-users <[hidden email]> On Behalf Of Alexander Gabriel
Sent: Friday, August 30, 2019 10:54 AM
To: [hidden email] Subject: [sqlite] error: unable to read database header
I downloaded the files for v3.29.0 into a folder.
Then double clicked sqlite3.exe to open a command shell.
Then typed `.open test.db`
Then typed `.dbinfo`
And got: `unable to read database header`
What am I doing wrong?
Have I created a broken database?