In Magento 1.0, the configuration file that contains database settings and other information is located here:

In Magento 2.0, the configuration is in the same directory (/app/etc/) but has been renamed to env.php. The file path is:

magento 2 数据库配置文件位置/app/etc/env.php

In this file, a number of key things are set, including the database connection information:

‘host’ => ‘localhost’,
‘dbname’ => ‘magento2database’,
‘username’ => ‘some-sample-username’,
‘password’ => ‘Extremely-Complicated-Password-12345’,
‘model’ => ‘mysql4’,
‘engine’ => ‘innodb’,
‘initStatements’ => ‘SET NAMES utf8;’,
‘active’ => ‘1’,