# Migrations complete successfully, test cannot access database

**URL:** <https://discuss.circleci.com/t/migrations-complete-successfully-test-cannot-access-database/35918>\
**Category:** Databases\
**Tags:** laravel\
**Created:** [May 13, 2020, 4:43pm UTC](https://discuss.circleci.com/t/migrations-complete-successfully-test-cannot-access-database/35918 "2020-05-13T16:43:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas379](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@thomas379](https://discuss.circleci.com/u/thomas379)\
**Post date:** [May 13, 2020, 4:43pm UTC](https://discuss.circleci.com/t/migrations-complete-successfully-test-cannot-access-database/35918/1 "2020-05-13T16:43:51Z")

</div>

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

ERRORS!

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

```

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

Thanks,  
Thomas

---

<div class="post-metadata">

**Author:** ![thomas379](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@thomas379](https://discuss.circleci.com/u/thomas379)\
**Post date:** [May 13, 2020, 10:00pm UTC](https://discuss.circleci.com/t/migrations-complete-successfully-test-cannot-access-database/35918/2 "2020-05-13T22:00:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nbialostosky](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/nbialostosky/32/24962_2.png) [@nbialostosky](https://discuss.circleci.com/u/nbialostosky)\
**Post date:** [May 18, 2020, 8:54pm UTC](https://discuss.circleci.com/t/migrations-complete-successfully-test-cannot-access-database/35918/3 "2020-05-18T20:54:12Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![thomas379](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@thomas379](https://discuss.circleci.com/u/thomas379)\
**Post date:** [May 19, 2020, 8:43am UTC](https://discuss.circleci.com/t/migrations-complete-successfully-test-cannot-access-database/35918/4 "2020-05-19T08:43:03Z")

</div>

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.

Thanks,

Thomas

---

<div class="post-metadata">

**Author:** ![nbialostosky](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/nbialostosky/32/24962_2.png) [@nbialostosky](https://discuss.circleci.com/u/nbialostosky)\
**Post date:** [May 20, 2020, 1:19pm UTC](https://discuss.circleci.com/t/migrations-complete-successfully-test-cannot-access-database/35918/5 "2020-05-20T13:19:24Z")

</div>

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](https://deployer.org/docs/configuration.html#ssh_multiplexing).

Hope that helps!

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 15, 2020, 7:40pm UTC](https://discuss.circleci.com/t/migrations-complete-successfully-test-cannot-access-database/35918/6 "2020-06-15T19:40:30Z")

</div>

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