# Dev setup fail - Failed to ping db err:driver: bad connection

**URL:** <https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504>\
**Category:** Troubleshooting\
**Created:** [November 16, 2016, 11:52am UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504 "2016-11-16T11:52:25Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![fraziern](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/fraziern/32/1006_2.png) [@fraziern](https://forum.mattermost.com/u/fraziern)\
**Post date:** [November 16, 2016, 11:52am UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504/1 "2016-11-16T11:52:25Z")

</div>

I’m trying to set up a local development environment and am getting stuck with database issues. Any help is appreciated.

Running OS X 10.11  
Gotten through the setup instructions but when I run `make run` I get the following:

```
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)
make: *** [start-docker] Error 255

```

When I try `make clean-docker,` then `make start-docker`, then `make run-server`, I get this:

```
[2016/11/16 06:38:42 EST] [INFO] Server is initializing...
[2016/11/16 06:38:42 EST] [INFO] Pinging sql master database
[MySQL] 2016/11/16 06:38:42 packets.go:32: EOF
[2016/11/16 06:38:42 EST] [CRIT] Failed to ping db err:driver: bad connection
exit status 102

```

`docker ps`:  
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES  
2066b033613e mattermost/webrtc:latest “/bin/sh -c /opt/janu” 12 minutes ago Up 11 minutes 0.0.0.0:7088-7089-\>7088-7089/tcp, 0.0.0.0:8188-8189-\>8188-8189/tcp mattermost-webrtc  
3c46780a03ef osixia/openldap:1.1.6 “/container/tool/run” 15 minutes ago Up 15 minutes 0.0.0.0:389-\>389/tcp, 0.0.0.0:636-\>636/tcp mattermost-openldap  
295feb9e3957 postgres:9.4 “/docker-entrypoint.s” 15 minutes ago Up 15 minutes 0.0.0.0:5432-\>5432/tcp mattermost-postgres  
9bc309abd2a2 mysql:5.7 “[docker-entrypoint.sh](http://docker-entrypoint.sh)” 16 minutes ago Up 15 minutes 0.0.0.0:3306-\>3306/tcp mattermost-mysql

Any ideas?

---

<div class="post-metadata">

**Author:** ![hmhealey](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/hmhealey/32/1915_2.png) [@hmhealey](https://forum.mattermost.com/u/hmhealey)\
**Post date:** [November 23, 2016, 3:04pm UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504/2 "2016-11-23T15:04:24Z")

</div>

Hi @fraziern,

Are you running Docker for Mac or Docker Toolbox? Depending on which you’re using, you’ll need to map `dockerhost` to a different address in `/etc/hosts`.

- If you’re using Docker for Mac, the first two steps of the [latest dev setup instructions](https://docs.mattermost.com/developer/developer-setup.html#mac-os-x) cover what you need to do
- If you’re on using Docker Toolbox, you’ll need to:
  1. Find out what IP address docker-machine is running on using `docker-machine ip dev`
  2. Add `<DOCKER_IP> dockerhost` to your `/etc/hosts` file.

---

<div class="post-metadata">

**Author:** ![fraziern](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/fraziern/32/1006_2.png) [@fraziern](https://forum.mattermost.com/u/fraziern)\
**Post date:** [December 2, 2016, 11:18am UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504/3 "2016-12-02T11:18:28Z")

</div>

Thanks @hmhealey - I am using Docker for Mac, and had setup /etc/hosts previously. I seem to be up and running now, though, after running `make run` several times in a row. Not sure what the issue is/was, but for now I’m good. Thanks again.

---

<div class="post-metadata">

**Author:** ![lindy65](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/lindy65/32/1811_2.png) [@lindy65](https://forum.mattermost.com/u/lindy65)\
**Post date:** [December 5, 2016, 8:08am UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504/4 "2016-12-05T08:08:01Z")

</div>

@fraziern, thanks for posting back! I’ll mark this issue solved for now but if you run into problems again, please feel free to post back.

---

<div class="post-metadata">

**Author:** ![hubert](https://avatars.discourse-cdn.com/v4/letter/h/9d8465/32.png) [@hubert](https://forum.mattermost.com/u/hubert)\
**Post date:** [January 14, 2017, 1:19am UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504/5 "2017-01-14T01:19:14Z")

</div>

I have the same issue, but on a linux debian machine.  
I ran into the problem when I first ran make run, but I managed to get passed it without really knowing how. I did a make stop and now I’m running into the issue and I can’t manage to get around it.

EDIT:  
Oh, I forgot that, in the meantime, I had an issue with a dead container and I tried this, which solved this problem but might be at the root the de bad driver problem.  
[http://stackoverflow.com/questions/30794108/docker-cannot-remove-dead-container](http://stackoverflow.com/questions/30794108/docker-cannot-remove-dead-container)

---

<div class="post-metadata">

**Author:** ![hubert](https://avatars.discourse-cdn.com/v4/letter/h/9d8465/32.png) [@hubert](https://forum.mattermost.com/u/hubert)\
**Post date:** [January 15, 2017, 8:07am UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504/6 "2017-01-15T08:07:14Z")

</div>

The only thing I found to solve the problem is rebooting my computer…

---

<div class="post-metadata">

**Author:** ![hubert](https://avatars.discourse-cdn.com/v4/letter/h/9d8465/32.png) [@hubert](https://forum.mattermost.com/u/hubert)\
**Post date:** [January 16, 2017, 2:45am UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504/7 "2017-01-16T02:45:50Z")

</div>

OK, I think I found a way to reproduce the issue.

make run (or run-server) while mySQL/postgreSQL services are running.  
After that, even if you stop the services, make stop and make clean-docker, the issue will alway reproduce until a system reboot.

---

<div class="post-metadata">

**Author:** ![morenoh149](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/morenoh149/32/1157_2.png) [@morenoh149](https://forum.mattermost.com/u/morenoh149)\
**Post date:** [February 23, 2017, 7:19pm UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504/8 "2017-02-23T19:19:46Z")

</div>

I’m getting the same issue. `make nuke` does not properly stop the databases.

Can we mark this as unsolved?  
unless restarting is a viable solution

in the meantime I’ll restrict myself to only using `make stop`.

Another stop gap is to restart docker. So,  
-\> `make stop`  
-\> restart docker

![](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/2/2474f3ad922cb5fb23ffceb6c5412745b6428411.png)

-\> `make run`

---

<div class="post-metadata">

**Author:** ![lindy65](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/lindy65/32/1811_2.png) [@lindy65](https://forum.mattermost.com/u/lindy65)\
**Post date:** [March 20, 2017, 7:14am UTC](https://forum.mattermost.com/t/dev-setup-fail-failed-to-ping-db-err-driver-bad-connection/2504/9 "2017-03-20T07:14:22Z")

</div>

Hi @morenoh149,

I’ve edited the issue to be “unsolved”… Could you help to give me a suitable updated title for the issue or does it remain as is?

Once we know the exact issue, it’ll be easier for someone to help with a solution.

Thanks!
