# Custome Database Issue

**URL:** <https://community.auth0.com/t/custome-database-issue/16840>\
**Category:** Get Help\
**Tags:** auth0\
**Created:** [October 16, 2018, 9:01pm UTC](https://community.auth0.com/t/custome-database-issue/16840 "2018-10-16T21:01:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![sravya](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sravya](https://community.auth0.com/u/sravya)\
**Post date:** [October 16, 2018, 9:01pm UTC](https://community.auth0.com/t/custome-database-issue/16840/1 "2018-10-16T21:01:11Z")

</div>

I am new to the auth0, trying to connect to the custom database using MYSQL I used the script which is generated by auth0 and changed the credentials in it and when am trying to connect it is showing connect ETIMEDOUT and i did enabled the import users to auth0 ,can anyone help me on this

---

<div class="post-metadata">

**Author:** ![npatel](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/npatel/32/15222_2.png) [@npatel](https://community.auth0.com/u/npatel)\
**Post date:** [October 17, 2018, 9:31am UTC](https://community.auth0.com/t/custome-database-issue/16840/2 "2018-10-17T09:31:24Z")

</div>

Did you whitelist your MYSQL to be accessible from auth0 IPs?

> **Heads up!** If you are trying to access a service behind a firewall, make sure to open the right ports and allow inbound connections from these IP addresses: `35.167.74.121,35.166.202.113,35.160.3.103,54.183.64.135,54.67.77.38,54.67.15.170,54.183.204.205`

---

<div class="post-metadata">

**Author:** ![sravya](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sravya](https://community.auth0.com/u/sravya)\
**Post date:** [October 17, 2018, 2:27pm UTC](https://community.auth0.com/t/custome-database-issue/16840/3 "2018-10-17T14:27:39Z")

</div>

Thanks for responding. No, but I am trying to whitelist now this is what I have and I am still getting timed out.

 ![image](https://global.discourse-cdn.com/auth0/original/2X/0/0e34f3549b3a50af64fad5f83e6ace5ced864406.png)

---

<div class="post-metadata">

**Author:** ![jerdog](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jerdog/32/11231_2.png) [@jerdog](https://community.auth0.com/u/jerdog)\
**Post date:** [October 17, 2018, 3:09pm UTC](https://community.auth0.com/t/custome-database-issue/16840/5 "2018-10-17T15:09:03Z")

</div>

Have you verified that on your MySQL database side you have whitelisted our IPs along with opened the right ports?

---

<div class="post-metadata">

**Author:** ![sravya](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sravya](https://community.auth0.com/u/sravya)\
**Post date:** [October 17, 2018, 4:18pm UTC](https://community.auth0.com/t/custome-database-issue/16840/6 "2018-10-17T16:18:07Z")

</div>

so you are talking about the ports where MYSQL is running?, I have one port open right now that is 3306 I am using XAMPP and phpmyadmin .

---

<div class="post-metadata">

**Author:** ![sravya](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sravya](https://community.auth0.com/u/sravya)\
**Post date:** [October 23, 2018, 2:05pm UTC](https://community.auth0.com/t/custome-database-issue/16840/7 "2018-10-23T14:05:09Z")

</div>

this is my script and i whitelisted the ipaddress.

```
function getByEmail(email, callback) {
  const mysql = require('mysql');

  const connection = mysql.createConnection({
    host: ' ********',
    user: 'root',
    password: ' *******',
    database: 'icsocial'
  });

  connection.connect();

  const query = 'SELECT id, email FROM users WHERE email = ?';

  connection.query(query, [email], function(err, results) {
    if (err || results.length === 0) return callback(err || null);

    const user = results[0];
    callback(null, {
      user_id: user.id.toString(),
      email: user.email
    });
  });
}

```

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [October 23, 2018, 2:46pm UTC](https://community.auth0.com/t/custome-database-issue/16840/8 "2018-10-23T14:46:10Z")

</div>

Hey there @sravya,

You can explicitly declare your port in the Auth0 database scripts by passing an additional `port` attribute to the `mysql` constructor as shown below.

```auto
mysql({
  host : '111.222.3.4',
  user : 'user',
  password : 'pass',
  database : 'mydb',
  port: 3306
});

```

When you get a moment can you try this and let us know if it helps with the ETIMEDOUT error? Thanks!

---

<div class="post-metadata">

**Author:** ![sravya](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sravya](https://community.auth0.com/u/sravya)\
**Post date:** [October 23, 2018, 2:50pm UTC](https://community.auth0.com/t/custome-database-issue/16840/9 "2018-10-23T14:50:46Z")

</div>

Hi @James.Morrison thank you for responding. I tried that, it gave me the same error

---

<div class="post-metadata">

**Author:** ![James.Morrison](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/james.morrison/32/13507_2.png) [@James.Morrison](https://community.auth0.com/u/James.Morrison)\
**Post date:** [October 23, 2018, 5:35pm UTC](https://community.auth0.com/t/custome-database-issue/16840/11 "2018-10-23T17:35:24Z")

</div>

I see you have a open support ticket that you are currently working with our support team to get to the bottom of this. To concentrate efforts i’ll have our support team take point on this front.

For historically thread context sake I will link the standard custom database documentation below and once a resolution from the ticket has been surfaced I will share that as well. Please let me know if you have any additional questions. Thanks!

> **[Create Custom Database Connections](https://auth0.com/docs/authenticate/database-connections/custom-db/create-db-connection)**
>
> Learn how to create a database connection.

> **[Auth0 IP Addresses for Allow Lists](https://auth0.com/docs/secure/security-guidance/data-security/allowlist)**
>
> Lists Auth0 IP addresses for use in allow lists for inbound traffic behind a firewall.

---

<div class="post-metadata">

**Author:** ![sravya](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@sravya](https://community.auth0.com/u/sravya)\
**Post date:** [October 23, 2018, 5:48pm UTC](https://community.auth0.com/t/custome-database-issue/16840/12 "2018-10-23T17:48:24Z")

</div>

ok thank you so much

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [November 22, 2018, 5:48pm UTC](https://community.auth0.com/t/custome-database-issue/16840/13 "2018-11-22T17:48:24Z")

</div>

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