Phinx: Problem connecting to mysql

Created on 3 Dec 2014  路  9Comments  路  Source: cakephp/phinx

I have a situation where mysql is installed and when attempting to run a migration I get InvalidArgumentException:

  [InvalidArgumentException]
  There was a problem connecting to the database: SQLSTATE[HY000] [2002] No such file or directory

But I can connect to mysql find with the credentials, from command line

bug

Most helpful comment

Hi, I had the same issue when using phinx with mysql in a separate docker container. The cause was configuring the host as localhost in the phinx env file. After changing the host to 127.0.0.1 it worked!

All 9 comments

Can you please run phinx with -vvv (very verbose output) and paste the relevant error location in code?

Also, please paste your connection config (remove password though ;) ).

This error should only happen when you attempt to use the unix_socket config with an invalid path.

sample yaml

    development:
        adapter: mysql
        host: localhost
        name: development_db
        user: root
        pass: ''
        port: 3306
        charset: utf8

I will have the output you requested later.

@BardiaAfshin any follow up on this?

Not yet

Please reopen if you can provide more complete logging.

Hey there, I'm struggling with the same issue for all day long and I can't find a solution.
I'm on Mac OS

Edit : Found my solution : the problem was that I forgot to start MySQL server ! (I'm totally new to back-end and I feel stupid I didn't think about it)

Hi, I had the same issue when using phinx with mysql in a separate docker container. The cause was configuring the host as localhost in the phinx env file. After changing the host to 127.0.0.1 it worked!

Be

Hi, I had the same issue when using phinx with mysql in a separate docker container. The cause was configuring the host as localhost in the phinx env file. After changing the host to 127.0.0.1 it worked!

SO GOOOOOOOOOD. Worked for me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kabirbaidhya picture kabirbaidhya  路  4Comments

resgef picture resgef  路  5Comments

Jeckerson picture Jeckerson  路  3Comments

Divi picture Divi  路  5Comments

J-Fricke picture J-Fricke  路  3Comments