Magento2: Running setup:config:set doesn't just update, but also deletes values, running it a second time fixes it (kind of)

Created on 31 Dec 2015  路  6Comments  路  Source: magento/magento2

Hi

When I run:

php bin/magento setup:config:set --db-user=username --db-password=password --db-name=new-database-name
Overwrite the existing configuration for db-name?[Y/n]Y
Overwrite the existing configuration for db-user?[Y/n]Y
Overwrite the existing configuration for db-password?[Y/n]Y
You saved the new configuration.

I would expect to see that the env.php file got updated with those 3 new values. And the file is updated correctly, but a bunch of other values have disappeared from the file:

  • db/table_prefix
  • db/connection/default/host
  • db/connection/default/model
  • db/connection/default/engine
  • db/connection/default/initStatement
  • db/connection/default/active

When running the exact same command again, just after the previous run, the missing values are back but we get some errors:

Overwrite the existing configuration for db-name?[Y/n]Y
Overwrite the existing configuration for db-user?[Y/n]Y
Overwrite the existing configuration for db-password?[Y/n]Y
We saved default values for these options: db-host, db-engine, db-prefix, db-model, db-init-statements.
We're sorry, an error occurred. Try clearing the cache and code generation directories. By default, they are: var/cache, var/di, var/generation, and var/page_cache.

  [InvalidArgumentException]
  MySQL adapter: Missing required configuration option 'host'

Looks like some kind of bug?

Might be related to #2623

Ready for Work

Most helpful comment

where can we find the fix for this ?

I've updated the admin uri using this command bin/magento setup:config:set --backend-frontname=admin_123 and since then I have the error MySQL adapter: Missing required configuration option 'host' showing up on all front (admin and frontend).

I'm on a Magento EE 2.0.9 installed via composer.

All 6 comments

@hostep can you please give more details, is this in the git version or deployed via composer create-project? If you are using git, which branch? #2623 has been fixed in the develop branch.

I use Magento 2.0.0, installed using composer.
If you can't reproduce it anymore on the develop branch, then it might be fixed indeed.
If the develop branch is stable enough to be usable, I could give it a shot to test it, unless you guys want to test it yourselves?

Thank you for your input. We have created MAGETWO-47531 to investigate.

We'd like to inform you that this has been resolved. In case you have any questions, please don't hesitate to submit a new issue.

where can we find the fix for this ?

I've updated the admin uri using this command bin/magento setup:config:set --backend-frontname=admin_123 and since then I have the error MySQL adapter: Missing required configuration option 'host' showing up on all front (admin and frontend).

I'm on a Magento EE 2.0.9 installed via composer.

where can we find the fix for this ?

I've updated the admin uri using this command bin/magento setup:config:set --backend-frontname=admin_123 and since then I have the error MySQL adapter: Missing required configuration option 'host' showing up on all front (admin and frontend).

I'm on a Magento EE 2.0.9 installed via composer.

To me helped:

app/etc/env.php

'db' field -> if field 'indexer': exists => required appending creditenials:

    'db' => [
        'table_prefix' => '',
        'connection' => [
            'default' => [
                'host' => '127.0.0.1',
                'dbname' => '',
                'username' => '',
                'password' => '',
                'active' => '1',
                'model' => 'mysql4',
                'engine' => 'innodb',
                'initStatements' => 'SET NAMES utf8;'
            ],
            'indexer' => [
                'host' => '127.0.0.1',
                'dbname' => '',
                'username' => '',
                'password' => '',
                'model' => 'mysql4',
                'engine' => 'innodb',
                'initStatements' => 'SET NAMES utf8;',
                'active' => '1',
                'persistent' => NULL
            ]
        ]
    ],
Was this page helpful?
0 / 5 - 0 ratings