'How to set up and connect to a remote mysql database via SSH from Yii2 advanced?
One of the databases in Yii2 advanced must be connected remotely. Server connects to remote server via SSH. Yii2 as installed on ubuntu server.
Solution 1:[1]
You can specify the database hostname (e.g. a hostname or an IP address as 127.0.0.1) and port as part of the dsn in
/environments/dev/common/config/main-local.php:
'components' => [
'db' => [
'class' => '\yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=yii2advanced',
...
],
],
Docs are here: Application components
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | WeSee |
