我已经将一个yii框架and应用程序迁移到了一个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',
), 为什么这种事会发生在我身上?
发布于 2014-01-23 21:21:56
如注释1和1中所述,不使用localhost作为主机,并在末尾移除套接字,因此尝试
'db'=>array(
'connectionString' => 'mysql:host=nombreusuario.db.1and1.com;dbname=nombrebasededatos',
'emulatePrepare' => true,
'username' => 'nombreusuario',
'password' => 'password,',
'charset' => 'utf8',
), https://stackoverflow.com/questions/21319355
复制相似问题