gpt4 book ai didi

php - Yii2 db mysql 连接抛出 ssh 端口 33060

转载 作者:行者123 更新时间:2023-11-29 01:16:21 32 4
gpt4 key购买 nike

我在连接到 mysql 数据库时遇到问题,在端口 33060 上抛出 ssh,我的 session :

return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=myDatabase',
'emulatePrepare' =>true,
'username' => 'user',
'password' => 'password',
'charset' => 'utf8',
];

我在尝试连接时打开了 ssh tunel,但出现错误:

SQLSTATE[28000] [1045] Access denied for user 'user'@'localhost' (using password: YES)

我做错了什么?在 Yii2 中可以连接 throws 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',
];

它必须是 127.0.0.1 而不是本地主机。感谢所有答案! :)

关于php - Yii2 db mysql 连接抛出 ssh 端口 33060,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31317255/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com