"Error: unable to open database" when creating sqlite3 database in terminal
By John Campbell •
The other questions I've seen deal with this have to do with creating databses through Django or some other Python framework. I am simply trying to create a database with $sqlite3 database.db. It opens up the sqlite console, but when I type .schema, I get Error: unable to open database "database.db": unable to open database file, and then get booted from the database. There's no database.db file leftover.
I cannot make sense of this.
21 Answer
A database file is not created until you actually add table(s). Try adding a table using:
sqlite> create table [table name]([field] [type]);
sqlite> .quitThen you should have a database file created.