skip to Main Content

I installed Magento with composer install, nginx server. When I am trying to launch my Magento in browser I am getting Error.

An error has happened during application run. See exception log for details.

I opened exception log file in my Magento2 directory and i see that error.

[2019-06-14 18:29:16] report.CRITICAL: MySQL adapter: Missing required
configuration option ‘host’ {“exception”:”[object] (InvalidArgumentException(code: 0): MySQL adapter: Missing required
configuration option ‘host’ at
/var/www/html/magento2/vendor/magento/framework/Model/ResourceModel/Type/Db/Pdo/Mysql.php:105)”}
[]

I dont know how to fix it. Searched in google but google says nothing about that error. Maybe someone can help me.

2

Answers


  1. Please check your app/etc/env.php and verify the entries specific to your database.
    I could fix my instance following the solution mentioned here. https://github.com/magento/magento2/issues/2852

    Login or Signup to reply.
  2. I had this error during bin/magento setup:upgrade after performing a php bin/magento setup:config:set ... command for redis caching. What happened was in app/etc/env.php, Magento created an entry ‘db’ => ‘connection’ => ‘indexer’ where there wasn’t one before. However it did not have any db info or credentials. It seems there’s not much documentation on this entry in env.php. What I did was set the default database connection values here and got it working.

    env.php

    ....
    'db' => [
        'table_prefix' => '',
        'connection' => [
            'default' => [
                'host' => 'some_db_host',
                'dbname' => 'some_db',
                'username' => 'some_db_user',
                'password' => 'some_db_pw',
                'model' => 'mysql4',
                'engine' => 'innodb',
                'initStatements' => 'SET NAMES utf8;',
                'active' => '1',
                'driver_options' => [
                    1014 => false
                ]
            ],
            'indexer' => [
                'host' => 'some_db_host',
                'dbname' => 'some_db',
                'username' => 'some_db_user',
                'password' => 'some_db_pw',
                'model' => 'mysql4',
                'engine' => 'innodb',
                'initStatements' => 'SET NAMES utf8;',
                'active' => '1',
                'persistent' => null
            ]
        ]
    ],  
    ....  
    

    Now I can run setup:upgrade with no error.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search