emilushi
emilushi

Reputation: 290

php artisan migrate with sqlite throws error, database is locked

I was trying to play a bit with Laravel and SQLite but whenever I run php artisan migrate I always get the same error: Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 5 database is locked (SQL: create table "migrations" ("id" integer not null primary key autoincrement, "migration" varchar not null, "batch" integer not null))

I tried all the options, tried running the command as sudo php artisan migrate but still no luck, As well I set directory and file permissions to 777 and still got the same error.

I'm running Laravel on vagrant box where host is Windows 10 and guest is Ubuntu 16.04 and using recommended synchronization method sync_type: smb.

I know that I can use MySQL or other drivers, I was just curios to see if anyone knows the why.

By the way i tried fuser database.sqlite and it returns empty which means no other process is using it.

What I notices is that when i run php artisan migrate a new file is created database.sqlite-journal which is synchronized on the host as well and I was thinking if it is possible that the IDE PhpStrom or the Host (Windows) is using the temporary database.sqlite-journal and locking it?!

Upvotes: 1

Views: 752

Answers (1)

emilushi
emilushi

Reputation: 290

OK, I found the issue but I don't know the reason?

I switched sync_type for synchronized folder between host (Windows) and guest (Ubuntu) from smb to default and everything worked perfectly.

If anyone knows why sync_type: smb causes this can post it.

Upvotes: 1

Related Questions