【问题标题】:Yii 1&1 DBConnectionYii 1&1 DBConnection
【发布时间】: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',
        ), 

为什么这会发生在我身上?

【问题讨论】:

标签: mysql yii frameworks


【解决方案1】:

如 cmets 1and1 中所述,不使用 localhost 作为主机并在最后删除套接字所以尝试

'db'=>array(
            'connectionString' => 'mysql:host=nombreusuario.db.1and1.com;dbname=nombrebasededatos',
            'emulatePrepare' => true,
            'username' => 'nombreusuario',
            'password' => 'password,',
            'charset' => 'utf8',
        ), 

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-11
  • 1970-01-01
  • 2016-09-16
  • 1970-01-01
相关资源
最近更新 更多