Est*_*ste 2 php mysql yii2 yii2-advanced-app yii2-basic-app
我有连接到mysql数据库的问题在端口33060上抛出ssh,我的conf:
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=myDatabase',
'emulatePrepare' =>true,
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',
];
Run Code Online (Sandbox Code Playgroud)
我尝试连接时打开ssh tunel,我有一个错误:
SQLSTATE [28000] [1045]用户'用户'@'localhost'拒绝访问(使用密码:YES)
我究竟做错了什么?有可能在Yii2连接抛出ssh吗?
谢谢你的回答!
我解决了这个问题...:
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=127.0.0.1;port=33060;dbname=myDatabase',
'emulatePrepare' =>true,
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',
];
Run Code Online (Sandbox Code Playgroud)
它必须是127.0.0.1而不是localhost.谢谢你的答案!! :)