Reputation: 189
I am just starting to learn laravel. I had given a database name (eg: mydatabase1) while beginning. Now want to change the db(eg: mydatabase2). I have updated the new database name database.php and .env files
. Still when I run a query in the model
$users = DB::table('tbl_users')->limit(1)->get();
It gives me error like this:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabase1.tbl_users' doesn't exist (SQL: select * from 'tbl_users' limit 1)
means its still considering first configuration. I wonder where i have to update to reflect the db name update. Please help
Upvotes: 0
Views: 33
Reputation: 1330
You need to restart the web server to apply new changes in .env file. Even after that if you are still getting same error check your newly added configs in dababase.php as well as check whether you have created database with the given name ('mydatabase1')
Upvotes: 1