Reputation: 19497
I have a database file on my computer called testing.sqlite, which contains a copy of me database that I want to use for testing (rather than connecting to my ordinary MySQL production server).
I created an entry in the config/database file in laravel as instructed, setting it to access the sqlite file, and it all look right. But when I try and actually do anything, I get the error message:
[Illuminate\Database\QueryException]
SQLSTATE[HY000]: General error: 26 file is encrypted or is not a database (SQL: select * from sqlite_master where type = 'table' and name = vendor_alerts)
I can access the file using sqlite testing.sqlite
from the command line, why can't laravel read it?
Upvotes: 1
Views: 1557
Reputation: 19497
The problem is that the version of sqlite is different. Laravel uses sqlite3, wheareas the sqlite command on your console might be an earlier version. Run sqlite -version
from the command line to check your version - is is probably 2 something. You need to install sqlite3, and you'll find that it is not compatible - i.e. sqlite3 testing.sqlite
will produce the same error you are getting from laravel.
So, upgrade your command line sqlite version, and copy the data into a new sqlite3 database, and laravel will work without trouble.
Upvotes: 1