# No connection could be made because the target machine actively refused it

**URL:** <https://community.influxdata.com/t/no-connection-could-be-made-because-the-target-machine-actively-refused-it/8790>\
**Category:** Telegraf\
**Tags:** influxdb\
**Created:** [February 27, 2019, 1:04pm UTC](https://community.influxdata.com/t/no-connection-could-be-made-because-the-target-machine-actively-refused-it/8790 "2019-02-27T13:04:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zafir\_Zarya](https://avatars.discourse-cdn.com/v4/letter/z/858c86/32.png) [@Zafir\_Zarya](https://community.influxdata.com/u/Zafir_Zarya)\
**Post date:** [February 27, 2019, 1:04pm UTC](https://community.influxdata.com/t/no-connection-could-be-made-because-the-target-machine-actively-refused-it/8790/1 "2019-02-27T13:04:43Z")

</div>

Hello,

I installed influxdb through: pip install influxdb. Then I tried executing the following code in python:

```
import influxdb
client = influxdb.InfluxDBClient(host='localhost', port=8086)
client.create_database('exam')

```

But I came across the following error:

> requests.exceptions.ConnectionError: HTTPConnectionPool(host=‘localhost’, port=8086): Max retries exceeded with url: /query?q=CREATE+DATABASE+%22exam%22 (Caused by NewConnectionError(‘\<urllib3.connection.HTTPConnection object at 0x000001DF4715D128\>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it’,))

I tried disabling the firewall, but I still get the error. What seems to be the problem?

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [February 27, 2019, 1:18pm UTC](https://community.influxdata.com/t/no-connection-could-be-made-because-the-target-machine-actively-refused-it/8790/2 "2019-02-27T13:18:50Z")

</div>

Hi ,  
have you started the influxd ?  
Is your database up and running ?  
can you connect using the influx cli ?  
best regards ,

---

<div class="post-metadata">

**Author:** ![Zafir\_Zarya](https://avatars.discourse-cdn.com/v4/letter/z/858c86/32.png) [@Zafir\_Zarya](https://community.influxdata.com/u/Zafir_Zarya)\
**Post date:** [February 27, 2019, 1:19pm UTC](https://community.influxdata.com/t/no-connection-could-be-made-because-the-target-machine-actively-refused-it/8790/3 "2019-02-27T13:19:33Z")

</div>

No, the documentation didn’t cover that part. I figured it should start on its own. How do I do that?

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [February 27, 2019, 1:23pm UTC](https://community.influxdata.com/t/no-connection-could-be-made-because-the-target-machine-actively-refused-it/8790/4 "2019-02-27T13:23:26Z")

</div>

In windows , you can search for the influxd.exe and start it 😉

---

<div class="post-metadata">

**Author:** ![Zafir\_Zarya](https://avatars.discourse-cdn.com/v4/letter/z/858c86/32.png) [@Zafir\_Zarya](https://community.influxdata.com/u/Zafir_Zarya)\
**Post date:** [February 27, 2019, 1:24pm UTC](https://community.influxdata.com/t/no-connection-could-be-made-because-the-target-machine-actively-refused-it/8790/5 "2019-02-27T13:24:55Z")

</div>

You are a life saver, thank you. Have a nice day.

---

<div class="post-metadata">

**Author:** ![linehammer](https://avatars.discourse-cdn.com/v4/letter/l/ebca7d/32.png) [@linehammer](https://community.influxdata.com/u/linehammer)\
**Post date:** [January 22, 2020, 6:29am UTC](https://community.influxdata.com/t/no-connection-could-be-made-because-the-target-machine-actively-refused-it/8790/6 "2020-01-22T06:29:21Z")

</div>

This error is a **network-related error** occurred while establishing a connection to the Server. It means that the error is occurring because there is no server listening at the **hostname and port** you assigned. It literally means that the machine exists but that it has no services listening on the **specified port**.

Generally, it happens that something is **preventing a connection** to the port or hostname. Either there is a **firewall blocking** the connection or the process that is hosting the service is **not listening** on that specific port. This may be because it is not running at all or because it is listening on a different port. More on…[no connection](http://csharp.net-informations.com/communications/connection.htm)

---

<div class="post-metadata">

**Author:** ![Fatemeh\_Esmaeily](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/fatemeh_esmaeily/32/6285_2.png) [@Fatemeh\_Esmaeily](https://community.influxdata.com/u/Fatemeh_Esmaeily)\
**Post date:** [April 21, 2021, 5:21am UTC](https://community.influxdata.com/t/no-connection-could-be-made-because-the-target-machine-actively-refused-it/8790/7 "2021-04-21T05:21:02Z")

</div>

thank u, it’s been a real problem for me, and i really didn’t think it might have been caused by this
