0

I am getting this error when I am accessing ORM in a script run from the command line:

Database_Exception [ 2 ]: mysql_connect(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) ~ MODPATH/database/classes/kohana/database/mysql.php [ 67 ]

This is my directory structure

application
--bootstrap.php
modules
content
--index.php
system

This is my database config:

$database_config = array
(
    'default' => array
    (
        'type'       => 'mysql',
        'connection' => array(
            'hostname'   => 'localhost',
            'database'   => 'driverslife',
            'username'   => 'root',
            'password'   => 'root',
            'persistent' => FALSE,
            'port'      => 8889
        ),
        'table_prefix' => '',
        'charset'      => 'utf8',
        'caching'      => FALSE,
        'profiling'    => TRUE,
    ),
);

When I echo MODPATH in the command line, it shows me the right path(slash appended). Is there anything I might be missing?

yretuta
  • 7,963
  • 17
  • 80
  • 151

1 Answers1

0

Use 127.0.0.1 instead of localhost in your config. More info here: Error when connecting to MySQL using PHP/PDO

Community
  • 1
  • 1
Kemo
  • 6,942
  • 3
  • 32
  • 39
  • this doesn't work, I now get this error: Database_Exception [ 2 ]: mysql_connect(): [2002] Connection refused (trying to connect via tcp://127.0.0.1:3306) ~ MODPATH/database/classes/kohana/database/mysql.php [ 67 ]. I updated question to show database config. I am using MAMP – yretuta Apr 01 '12 at 07:39