2

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.

Jan Beeck
  • 303
  • 8
  • 24

3 Answers3

-1

host=myURL ?? try host=localhost

Unless you are using a different machine for the mysql server, but I guess you are not.

Mihai P.
  • 9,307
  • 3
  • 38
  • 49
-1

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;
tnchalise
  • 1,573
  • 2
  • 18
  • 38
-1

You can also check the php-mysql module install on your server.

apt-get install php-mysql