Migrations complete successfully, test cannot access database

When running a build of my Laravel project, the migrations to a sqlite database complete successfully. However, when it gets to the test, I get the following error:

1) NoAuthCest: Try to test

Test  tests/functional/NoAuthCest.php:tryToTest

[PDOException] SQLSTATE[HY000] [2002] Connection refused  

#1  /home/circleci/project/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:70
#2  /home/circleci/project/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:100
#3  /home/circleci/project/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:50
#4  /home/circleci/project/vendor/laravel/framework/src/Illuminate/Database/Connectors/MySqlConnector.php:24
#5  /home/circleci/project/vendor/laravel/framework/src/Illuminate/Database/Connectors/ConnectionFactory.php:182
#6  Illuminate\Database\Connectors\ConnectionFactory->Illuminate\Database\Connectors\{closure}
#7  /home/circleci/project/vendor/laravel/framework/src/Illuminate/Database/Connection.php:924
#8  /home/circleci/project/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php:157
#9  /home/circleci/project/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php:125
#10 /home/circleci/project/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php:105


Tests: 1, Assertions: 0, Errors: 1.

I’m at a complete loss with where to head next, any help would be much appreciated.


Further investigation showed it was a .env problem. I forgot to override the laravel default database provider.

Thanks for following up on this topic and confirming what the issue was!

I wanted to also note that we sometimes see this error when a build has run out of memory while it was running. If you encounter this again, and it isn’t a .env issue, feel free to submit a support ticket and we can check the memory usage for you!

Hi Nick,

Thanks for the email.

Unfortunately, the issue isn’t fixed as deployer still doesn’t put the release out, due from what I can see to be an authentication issue.

Deployer think the issue isn’t on their end, however a CircleCI instance can SSH to the box, just not work through deployer.

If you think the issue is with Deployer and not CircleCI, I’ll happily take it back to them.



Hi Thomas,

Thanks for the information here, I also saw that you had an open support ticket so we addressed this there.

However, for future folks that may also run into this, one of the items that may have been involved was having ssh_multiplexing set to true. So as a first step try disabling that following the guidelines on Deployers documentation.

Hope that helps!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.