【发布时间】:2014-01-23 21:09:26
【问题描述】:
我已将 yii 框架 webapp 迁移到 1&1 服务器,但无法连接数据库。错误是:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] Connection refused
在我的 config/main.php 我有这个:
'db'=>array(
'connectionString' => 'mysql:host=localhost:/tmp/mysql5.sock;dbname=nombrebasededatos',
'emulatePrepare' => true,
'username' => 'nombreusuario',
'password' => 'password,',
'charset' => 'utf8',
),
为什么这会发生在我身上?
【问题讨论】:
-
1&1 不使用 localhost 作为主机,但每个 db 都有一个特定的主机名,请参阅help.1and1.com/hosting-c37630/linux-c85098/…
-
你能写代码吗?拜托,因为我写的不好用
标签: mysql yii frameworks