Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
MAMP and invalid data source name
  • Hi all,

    I am running MAMP on a Mac and I have problem when trying the 'php oil refine migrate'
    it says:
    Previous exception: 
    Uncaught exception PDOException: invalid data source name

    my config:
    db.php (development)
    return array(
    'default' => array(
    'connection'  => array(
    'dsn'        => 'mysql:host=localhost;dbname=office4',
    'username'   => 'root',
    'password'   => 'root',
    'port'=>'8889',
    ),
    ),
    );

    when I test connect:
    <?php

    $dsn = 'mysql:dbname=office4;host=localhost;port=8889';
    $user = 'root';
    $password = 'root';

    try {
        $dbh = new PDO($dsn, $user, $password);
    echo 'connection is established.';
    } catch (PDOException $e) {
        echo 'Connection failed: ' . $e->getMessage();
    }
    it works fine.


    Any idea why oil would not connect?

  • It works if I use the unix_socket to connect to MAMP MYSQL server like:

    return array(
    'default' => array(
    'connection'  => array(
    'dsn'        => 'mysql:unix_socket=/Applications/MAMP/tmp/mysql/mysql.sock;dbname=dbname',
    'username'   => 'root',
    'password'   => '',
    ),
    ),
    );
  • Are you sure oil use development environnement ?

Howdy, Stranger!

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

In this Discussion