The SSH access or Command Line Interface (CLI) provides facility for developers to run commands provided by Magento 2 extensions. In this post I am going to explain How to Set System Configuration Value Using CLI Command in Magento 2.

Using below commands, you can set or display configuration values

To set the value of configuration setting

Syntax:

php bin/magento config:set [<config_path>] [value]

The config path is <section_id>/<group_id>/<field_id>

If the path is incorrect, this command returns an error. The “wrong/config/path” does not exist

For Example,

php bin/magento config:set web/secure/base_url https://www.example.com/

Now below is the example to set value website wise

php bin/magento config:set –scope=websites –scope-code=base web/secure/base_url https://www.example.com/

Now below is the example to set value store wise

php bin/magento config:set –scope=stores –scope-code=default web/secure/base_url https://www.example.com/

Now to the value of configuration settings

Syntax:

php bin/magento config:show [<config_path>]

For Example,

php bin/magento config:show web/secure/base_url

That’s it.

If you have any query about the above code then you can ask in the comment section below.

Check this Best Magento 2 Tutorial.

Thank You.