1

Laravel by default asks for a db called "laravel" and a users table called "users", but I named them in a different way and I want to make it works. Below the error it gives me:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'laravel.users' doesn't exist

EDIT: I kept the default config/database.php, changing nothing inside of it.

1 Answer 1

1

You need to update your database name in config/database.php (check connections array) to not user laravel database. Please check .env file too, for laravel database name references.

To not use users table you need to update your User class's $table property. (User class comes with default laravel installation).

RegisterController/@validator method need to be updated to for a different table.

Sign up to request clarification or add additional context in comments.

9 Comments

Everything fine with my env file. DB_DATABASE=mydbname What do I have to change in my User class's? Please be more specific
did you run php artisan config:clear after you changed .env variable(s)
Yes I did. But the problem remains
could you edit your question and add database.php - also what about the users.table ?
Actually the error changed, sorry I didn't notice it: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pyramid.users' doesn't exist. Of course pyramid is my db name.
|

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.