amuehlem / MISP-RPM

RPM packages for MISP
34 stars 15 forks source link

MISP RPM - Database connection "Mysql" is missing or could not be created. #80

Closed iZAK328 closed 1 year ago

iZAK328 commented 1 year ago

Hi,

We had performed a migration of the database from /var/lib/mysql to a custom location. The following are the database.php configuration.

class DATABASE_CONFIG {

        public $default = array(
                'datasource' => 'Database/Mysql',
                //'datasource' => 'Database/Postgres',
                'persistent' => false,
                'host' => '127.0.0.1',
                'login' => 'misp',
                'port' => 3306, // MySQL & MariaDB
                //'port' => 5432, // PostgreSQL
                'password' => '*********',
                'database' => 'misp',
                'prefix' => '',
                'encoding' => 'utf8',
        );
}

However, we are receiving the following error while running jobs to fetch feeds as shown below. image

Exception: MissingConnectionException Error: Database connection "Mysql" is missing, or could not be created.

`

0 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Datasource/DboSource.php(278): Mysql->connect()

1 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/ConnectionManager.php(105): DboSource->__construct()

2 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(3659): ConnectionManager::getDataSource()

3 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(1162): Model->setDataSource()

4 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(3686): Model->setSource()

5 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(1394): Model->getDataSource()

6 /var/www/MISP/app/Plugin/SysLogLogable/Model/Behavior/SysLogLogableBehavior.php(283): Model->schema()

7 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/BehaviorCollection.php(145): SysLogLogableBehavior->setup()

8 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/BehaviorCollection.php(66): BehaviorCollection->load()

9 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(781): BehaviorCollection->init()

10 /var/www/MISP/app/Model/AppModel.php(107): Model->__construct()

11 /var/www/MISP/app/Model/User.php(237): AppModel->__construct()

12 [internal function]: User->__construct()

13 /var/www/MISP/app/Lib/cakephp/lib/Cake/Utility/ClassRegistry.php(169): ReflectionClass->newInstance()

14 /var/www/MISP/app/Plugin/SysLogLogable/Model/Behavior/SysLogLogableBehavior.php(279): ClassRegistry::init()

15 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/BehaviorCollection.php(145): SysLogLogableBehavior->setup()

16 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/BehaviorCollection.php(66): BehaviorCollection->load()

17 /var/www/MISP/app/Lib/cakephp/lib/Cake/Model/Model.php(781): BehaviorCollection->init()

18 /var/www/MISP/app/Model/AppModel.php(107): Model->__construct()

19 /var/www/MISP/app/Model/Server.php(191): AppModel->__construct()

20 [internal function]: Server->__construct()

21 /var/www/MISP/app/Lib/cakephp/lib/Cake/Utility/ClassRegistry.php(169): ReflectionClass->newInstance()

22 /var/www/MISP/app/Lib/cakephp/lib/Cake/Console/Shell.php(316): ClassRegistry::init()

23 /var/www/MISP/app/Lib/cakephp/lib/Cake/Console/Shell.php(269): Shell->loadModel()

24 /var/www/MISP/app/Lib/cakephp/lib/Cake/Console/Shell.php(228): Shell->_loadModels()

25 /var/www/MISP/app/Console/Command/AppShell.php(42): Shell->initialize()

26 /var/www/MISP/app/Console/Command/AppShell.php(47): AppShell->initialize()

27 /var/www/MISP/app/Vendor/kamisama/php-resque-ex/lib/Resque/Job.php(199): AppShell->perform()

`

Please let us know how to fix this issue.

Thanks.

amuehlem commented 1 year ago

Hello

Are you sure the database change was successful? Can you connect to the database using the command line interface or any DB client (e.g. dbeaver) and do you see all the tables in the MISP database? From the errors it looks like your database is not running correctly and MISP cannot establish a connection to the database.

Best