user2406735
user2406735

Reputation: 245

Connection with database Doctrine PDO

I am using Zend framework with Doctrine, and i am transfering from localhost to my server, but i receve this error. Everything is working well localy.

Warning: PDO::__construct() [pdo.--construct]: [2002] No such file or directory 
(trying to connect via unix:///tmp/mysql.sock) in /www/webvol19/94/yi8ghefpta7q527/
mywebsite.com/vendor/doctrine/Doctrine/DBAL/Driver/PDOConnection.php on line 36

My connection settings are these:

// pdo connection definition

'db' => array(
    'driver'         => 'Pdo',
    'dsn'            => 'mysql:dbname=dbname123;host=mysql410.ddd.com',
    'username' => 'user',
    'password' => 'pass121512',
    'driver_options' => array(
        PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''
    ),
),

// doctrine connection definition
'doctrine_config' => array (
    'proxy_directory' => APP_PATH 
                         . DIRECTORY_SEPARATOR 
                         . 'data'
                         . DIRECTORY_SEPARATOR
                         . 'Doctrineproxy',
    'proxy_namespace' => 'Doctrineproxy',
    'doctrine_db_conn_params' => array (
        'driver'   => 'pdo_mysql',
        'user'     => 'user',
        'password' => 'pass121512',
        'dbname'   => 'dbname123',
    ),
    'is_dev_mode' => true,
),

i am not sure what is this before my website name

/www/webvol19/94/yi8ghefpta7q527/

Upvotes: 0

Views: 1772

Answers (1)

Microbe
Microbe

Reputation: 465

You say that you transferring from localhost to your server but application still connects to localhost.

Doctrine config include its own database parameters and independent from outside predefined database configuraiton. In your case you must to point host and (optionally) port inside 'doctrine_config':

'doctrine_config' => array (
    ...
    'doctrine_db_conn_params' => array (
        'driver'   => 'pdo_mysql',
        'user'     => 'user',
        'password' => 'pass121512',
        'dbname'   => 'dbname123',
        /* add this */
        'host' => 'mysql410.ddd.com',
        //'port' => 3306
    ),
    ...
),

Upvotes: 1

Related Questions