Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
This morning I got an error from connection.php
  • Hello there,

    My batch program suddenly got following error for 3 times.

    2002 - SQLSTATE[HY000] [2002] 
    No such file or directory  in ..../fuel/core/classes/database/pdo/connection.php 

    Do you have any suggestion why I am getting this errors?

    mysql  Ver 14.14 Distrib 5.7.27, for Linux (x86_64) 
    PHP 7.0.33-0ubuntu

    Best regards,
  • It means PDO can't connect to the database, so either your DB config is wrong, or your programme can't find the correct config.

    Most common error are:
    * using a socket while you need to connect to an IP
    * using "localhost" instead of 127.0.0.1 (on some platforms)
  • Thanks for your comments. 

    However, my batch is up and running without any issue after these errors as well as my front-end app. 

    My config file seems fine for me.

    Here is my config.

    return array(
      'default' => array(
        'connection'  => array(
          'dsn'        => 'mysql:host=localhost;dbname=mydb',
          'username'   => 'username',
          'password'   => 'password',
        ),
    );

    This is weird for me.
  • HarroHarro
    Accepted Answer
    Does the server run a dual stack, or is IPv6 completely disabled?

    If not, change it to

      'dsn'        => 'mysql:host=127.0.0.1;dbname=mydb',

    If you develop on a Mac, you should do the same.

  • Okay, thanks for that.

    I will do it.


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion