Where in Yii2 do the connection to the database

0

In the Yii2 Framework application I am using the "advanced" template, I am having difficulty making the connection.

Where in the framework is the connection to the mysql database made?

    
asked by anonymous 28.04.2017 / 00:54

1 answer

0

The file that must declare the connection to the database is main-local.php The print below shows the exact place where you are.

Within the file you should find something like this.

'components' => [
    'db' => [
        'class' => 'yii\db\Connection',
        'dsn' => 'mysql:host=localhost;dbname=nome_base_de_dados',
        'username' => 'nome_utilizador',
        'password' => 'password_base_de_dados',
        'charset' => 'utf8',
    ],
],

Where you should only change the data access to the database.

    
14.02.2018 / 17:52