Auth0 Home Blog Docs

Connect to local DB

With the help of own custom DB feature, I want to connect to my local systems DB.
I am connecting local DB with auth0 by ngrok.

I have already created a connection, and used all the MySQL templates to connect with this DB.
But while clicking on Try button. It is just loading and gives the following error.

ERROR:-> "connect ETIMEDOUT".

template connection script is below.

function login(email, password, callback) {
  const mysql = require('mysql');
  const bcrypt = require('bcrypt');

  const connection = mysql.createConnection({
    host: '',  // this link is generated by ngrok
    user: 'root', //usernae
    password: '', //pass
    port: 3306, //port
    database: 'mycustomdb' //


And also how can I use these scripts in laravel(front-end =reactjs)?
one thing i want to without “createConnection” gives me this error.
2)“[SandboxUnhandledError] MySQL is not a function”.
if you want tenant name or any plz ask for it.
I am beginner one n the auth0.

Hello! Welcome to our community.

This error could be high latency between Auth0, ngrok and the local machine. We recommend to use a database in an actual server.


1 Like

Hi @lucas.sonich,
i have tried with server but below msg is showing.
{ Error: ER_ACCESS_DENIED_ERROR: Access denied for user ‘myuser’@‘’ (using password: YES)
at Handshake.Sequence._packetToError (/data/_verquire/mysql/2.7.0/node_modules/mysql/lib/protocol/sequences/Sequence.js:48:14)
at Handshake.ErrorPacket (/data/_verquire/mysql/2.7.0/node_modules/mysql/lib/protocol/sequences/Handshake.js:101:18)
at Protocol._parsePacket (/data/_verquire/mysql/2.7.0/node_modules/mysql/lib/protocol/Protocol.js:271:23)
at Parser.write (/data/_verquire/mysql/2.7.0/node_modules/mysql/lib/protocol/Parser.js:77:12)
at Protocol.write (/data/_verquire/mysql/2.7.0/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket. (/data/_verquire/mysql/2.7.0/node_modules/mysql/lib/Connection.js:96:28)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)

at Protocol._enqueue (/data/_verquire/mysql/2.7.0/node_modules/mysql/lib/protocol/Protocol.js:135:48)
at Protocol.handshake (/data/_verquire/mysql/2.7.0/node_modules/mysql/lib/protocol/Protocol.js:52:41)
at Connection.connect (/data/_verquire/mysql/2.7.0/node_modules/mysql/lib/Connection.js:123:18)
at login (/data/io/20c5ba8a-90c9-4e48-af48-52d5d5d188dc/webtask.js:18:15)
at /data/io/20c5ba8a-90c9-4e48-af48-52d5d5d188dc/webtask.js:44:2
at Async.waterfall (/data/sandbox/lib/sandbox.js:617:33)
at nextTask (/data/sandbox/node_modules/async/dist/async.js:5324:14)
at next (/data/sandbox/node_modules/async/dist/async.js:5331:9)
at /data/sandbox/node_modules/async/dist/async.js:969:16
at Async.waterfall (/data/sandbox/lib/sandbox.js:506:24)
errno: 1045,
sqlState: ‘28000’,
fatal: true }

My code is:
function login(email, password, callback) {
const mysql = require(‘mysql’);
const bcrypt = require(‘bcrypt’);

const connection = mysql.createConnection({
host: MY_HOST,
user: configuration.MY_USER,
password: configuration.MY_PASS,
database: configuration.MY_DB
plz reply ASAP.


We noticed that the information in your code might be the template information (e.g. user ‘myuser’). You will need to provide your own information to your code to be able to connect to your server.


1 Like