MySQL and Laravel 5.1, migrations failing

php
mysql

#1

Hello, my build is currently failing on my master branch. This branch was just merged from develop, which succeded.

It fails at the migration:

php artisan migrate --force --env=production --no-interaction -vvv
[PDOException] SQLSTATE[HY000] [2002] No such file or directory

My circle.yml:

machine:
  timezone:
    America/Chicago

  php:
    version: 5.5.9

  environment:
    APP_ENV: testing
    DB_HOST: 127.0.0.1
    DB_DATABASE: circle_test
    DB_USERNAME: ubuntu

dependencies:
  override:
    - composer install --prefer-source --no-interaction
    - npm install
    - npm install -g bower
    - npm install -g gulp
    - bower install
    - gulp

  pre:
    - echo "memory_limit = 1024M" > ~/.phpenv/versions/5.5.9/etc/conf.d/memory.ini

  post:
    - php artisan optimize
    - sudo chmod -R 775 storage
    - sudo chmod -R 775 bootstrap/cache

test:
  post:
    - phpunit

database:
  override:
    - php artisan migrate --force --env=production --no-interaction -vvv
    - php artisan db:seed --force --env=production --no-interaction -vvv

#2

If you SSH into the build and run the step manually do you get any additional logging?


#3

No additional logging, same output.


#4

Have you seen this? http://stackoverflow.com/questions/20723803/pdoexception-sqlstatehy000-2002-no-such-file-or-directory


#5

Yes, running either with a forced env, or without causes the same error. What puzzles me, is that the database migrates correctly with the same env/files, on the develop branch.


#6

What I’ve attempted so far:

  • DB_HOST as either localhost or 127.0.0.1
  • with or without a UNIX_SOCKET variable (/tmp/mysql.sock)
  • php artisan migrate with our without --env

#7

Did you try rebuilding without cache? Have you force-pushed to the master branch recently?


#8

Hello, I just tried rebuilding without cache without success. I did force-push into the branch, but the merge was not a forced push.


#9

I would like to clear your source cache and see if that changes anything. Do you mind reaching out to sayhi@circleci.com referencing this post? I’ll get that done for you.


#10

Okay, it was an error on my part, one of my migration file was trying to access another database, which of course didn’t exist. Thanks a lot for your time and help.


#11

Glad you were able to figure this out!


#12