I have problem with connecting to mysql database throw ssh on port 33060, My conf :
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=myDatabase',
'emulatePrepare' =>true,
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',
];
I have open ssh tunel when I try to connect, and i have an error:
SQLSTATE[28000] [1045] Access denied for user 'user'@'localhost' (using password: YES)
What am I doing wrong? Is possible in Yii2 to connect throws ssh?
Thanks for answers!
I was solve this problem... :
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=127.0.0.1;port=33060;dbname=myDatabase',
'emulatePrepare' =>true,
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',
];
It must be 127.0.0.1 not localhost. Thanks for all answers !! :)
I suspect your main issues would be that you have not specified the port:
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;port=33060;dbname=myDatabase',
'emulatePrepare' =>true,
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',
];
I assume that you meant to put 33060 as opposed to 3306.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With