odan / slim4-skeleton

A Slim 4 Skeleton
https://odan.github.io/slim4-skeleton/
MIT License
439 stars 80 forks source link

Migration Error #4

Closed darkalchemy closed 4 years ago

darkalchemy commented 4 years ago

Hello,

I am still very new to slim and to your project. I have just created a new test project following the instructions in the documentation. When I get to composer migrate it errors with this

> phinx migrate -c config/phinx.php --ansi
Phinx by CakePHP - https://phinx.org.

using config file ./config/phinx.php

In Driver.php line 92:

  SQLSTATE[HY000] [2002] No such file or directory  

migrate [-c|--configuration CONFIGURATION] [-p|--parser PARSER] [-e|--environment ENVIRONMENT] [-t|--target TARGET] [-d|--date DATE] [-x|--dry-run] [--fake]

Script phinx migrate -c config/phinx.php --ansi handling the migrate event returned with error code 255

I guessed that I missed something so I started over and retraced the steps. It errors with the same error, each time.

Could you help me to figure out what I am missing or doing wrong?

Thanks

odan commented 4 years ago

Hi @darkalchemy

The error message indicates that a MySQL connection via socket is tried (which is not supported).

I guess this is just an database connection configuration (maybe in combination with docker) issue. You can try to replace the default database 'host' => 'localhost', with: 'host' => '127.0.0.1'.

darkalchemy commented 4 years ago

Thank you for the response. Yes, I am running this in a docker container. I have added it config/env.php so it looks like this.

$settings['db']['database'] = 'test';
$settings['db']['username'] = 'root';
$settings['db']['password'] = '';
$settings['db']['host'] => '127.0.0.1'

and a different error shows now

> phinx migrate -c config/phinx.php --ansi
Phinx by CakePHP - https://phinx.org.

using config file ./config/phinx.php
Script phinx migrate -c config/phinx.php --ansi handling the migrate event returned with error code 255

I appreciate you taking the time to assist a newbie!

odan commented 4 years ago

handling the migrate event returned with error code 255

The exit code 255 sounds like a PHP fatal error.

I assume the problem can come from multiple sources.

PS: Enable the verbose output. Open composer.json and change

"migrate": "phinx migrate -c config/phinx.php --ansi",

to

"migrate": "phinx migrate -c config/phinx.php --ansi -vvv",

darkalchemy commented 4 years ago

Ah, I think the error is mysql and mysql_native_password. I don't believe php-pdo can use the new secure password.

Thank you for your help and this project.