4

I'm studying laravel then I switched mysql from sqlite. I deleted the database.sqlite file, configure the database.php to mysql and .env file.

I'm having a error "Database (database.sqlite) does not exist". How to fix this error?

3
  • 2
    Please show contents of .env and /config/database.php files Commented May 17, 2016 at 15:14
  • @AlexeyMezenin I think Im connected but I have another error it says "SQLSTATE[HY000]: General error: 1 no such table: users (SQL: select * from "users")" Commented May 17, 2016 at 15:20
  • 3
    Run php artisan migrate command, it will create users table Commented May 17, 2016 at 15:27

3 Answers 3

10

The sqlite driver doesn't create the database file if it doesn't exist.

The simple solution is to create an empty file just before migrating the database into it (filling the file with schemas and data)

Simply put, this command will fix it:

 touch database/database.sqlite
Sign up to request clarification or add additional context in comments.

1 Comment

this is not working for me
2

You don't need anything in the .env file except the DB_CONNECTION key/value pair. When you are using SQLite, remove all of the following keys:

DB_HOST

DB_PORT

DB_DATABASE

DB_USERNAME

DB_PASSWORD

3 Comments

Can you explain further how this fixes the problem of a non-existing file?
In my case the file exists, and the proposed solution did not work for me. This is the solution that worked for me that I posted.
I've spent the last few hours trying to get MySQL, PostgreSQL and then Sqlite to work. Following this and removing the other items from the .ENV file is what actually worked. Thanks.
0

If the above solution can not handle the current issue. click here

Issue with SQLite and Laravel on Heroku

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.