sergio_hw
(Sergio)
1
I have migrated a yii framework webapp to a 1&1 server and i am having troubles to connect with the database. The error is:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2002] Connection refused
In my config/main.php i have this:
'db'=>array(
'connectionString' => 'mysql:host=localhost:/tmp/mysql5.sock;dbname=nombrebasededatos',
'emulatePrepare' => true,
'username' => 'nombreusuario',
'password' => 'password,',
'charset' => 'utf8',
),
Why can this be happening to me?
Check your DSN twice, "mysql:host=localhost:/tmp/mysql5.sock" looks weird.
http://www.php.net/manual/en/ref.pdo-mysql.connection.php
(usually you use host/port OR unix socket)
sergio_hw
(Sergio)
3
Can you put an example? I dont get it T_T
Your connection string must be either
'connectionString' => 'mysql:host=localhost;dbname=nombrebasededatos',
or
'connectionString' => 'mysql:unix_socket=/tmp/mysql5.sock;dbname=nombrebasededatos',
but not host+unix_socket.
sergio_hw
(Sergio)
5
With the first one the error is this:
CDbConnection failed to open the DB connection: SQLSTATE[HY000] [2054] Connecting to 3.22, 3.23 & 4.0 servers is not supported
With the second one is the page stay white, no result.
samdark
(Alexander Makarov)
6
It seems you have way too old MySQL.