After downloading Yii 2 with advanced application template 2.0.8 from the official site and unpack the archive; in the command line we write init :

After that, the file yii-advanced-app-2.0.8 \ advanced \ common \ config \ main-local.php is created , which contains the database access settings on the local computer:
<?php return [ 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=yii2advanced', 'username' => 'root', 'password' => '', 'charset' => 'utf8', ], 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@common/mail', // send all mails to a file by default. You have to set // 'useFileTransport' to false and configure a transport // for the mailer to send real emails. 'useFileTransport' => true, ], ], ];
We connect our existing database by changing the name (for example, y2 ) in the yii-advanced-app-2.0.8 \ advanced \ common \ config \ main-local.php file :
<?php return [ 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=y2', 'username' => 'root', 'password' => '', 'charset' => 'utf8', ], 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@common/mail', // send all mails to a file by default. You have to set // 'useFileTransport' to false and configure a transport // for the mailer to send real emails. 'useFileTransport' => true, ], ], ];
and check the connection by clicking on the link (after running the local web server):
http: //localhost/yii-advanced-app-2.0.8/advanced/frontend/web/index.php


We load the database to a remote server, look at the access settings in the hosting control panel, and make changes to the yii-advanced-app-2.0.8 \ advanced \ common \ config \ main-local.php file :
<?php return [ 'components' => [ 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=test.mysql.ukraine.com.ua;dbname=test_yii', 'username' => 'test_yii', 'password' => '76dk9fkr', 'charset' => 'utf8', ], 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'viewPath' => '@common/mail', // send all mails to a file by default. You have to set // 'useFileTransport' to false and configure a transport // for the mailer to send real emails. 'useFileTransport' => true, ], ], ];
after which we download all the files from the advanced directory to the remote server.