Laravel choosing wrong database

  laravel, php

I host an Apache PHP server on which there’s a couple of websites. Let’s call these X and Y.

After I cleared the cache (and made some changes) on both my laravel websites, I get the following error often:

[previous exception] [object] (PDOException(code: 42S02): SQLSTATE[42S02]: Base table or view not found: 1146 Table 'Y.events_ip' doesn't exist at C:Apache24htdocsXvendordoctrinedballibDoctrineDBALDriverPDOConnection.php:78)

It seems that the X website wants to use the Y website’s database, even though the .env file is setup correctly and has the X website’s database in it.

Things I have tried:
Restarting apache
Deleting cache of the laravel application
Checking the configuration in the .env file as well as the config/database file

Source: Laravel

Leave a Reply