I have the following settings in config/db.php
:
return [
'class' => 'yii\db\Connection'
'dsn' => 'mysql:host=myURL;dbname=mydb',
'username' => 'mydbUsername',
'password' => 'mydbPassword',
'charset' => 'utf8',
];
That above string works in my test-machine, however in the server where I deployed the app does not work.
What is wrong? Thanks.
host=myURL
?? try host=localhost
Unless you are using a different machine for the mysql server, but I guess you are not.
If you have different host name, then try chaning host name. But i think the connection is refused because, you are trying to access your mysql server with different port number.
Try with this:
mysql:host=hostName;dbname=dbName;port=portNumber;