# \[SandboxUnhandledError\] mysql is not a function when using custom database

**URL:** <https://community.auth0.com/t/sandboxunhandlederror-mysql-is-not-a-function-when-using-custom-database/43860>\
**Category:** Get Help\
**Tags:** custom-database\
**Created:** [May 31, 2020, 11:11pm UTC](https://community.auth0.com/t/sandboxunhandlederror-mysql-is-not-a-function-when-using-custom-database/43860 "2020-05-31T23:11:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kdesimini](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kdesimini/32/21577_2.png) [@kdesimini](https://community.auth0.com/u/kdesimini)\
**Post date:** [May 31, 2020, 11:11pm UTC](https://community.auth0.com/t/sandboxunhandlederror-mysql-is-not-a-function-when-using-custom-database/43860/1 "2020-05-31T23:11:40Z")

</div>

I’ve taken a look at [this article](http://community.auth0.com/t/custom-database-error-mysql-is-not-a-function/21052) and the suggestion solution stopped working for me after a few hours.

I’m attempting to use the MySQL template for creating a user for a custom database.

As suggested, I changed the code to follow the solution.

```
  function create(user, callback) {
  const mysql = require('mysql');
  const bcrypt = require('bcrypt');

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

connection.connect();

const query = 'INSERT INTO manager SET ?';

const insert = {
  password: 'hello',
  email: user.email
};

connection.query(query, insert, function(err, results) {
  if (err) return callback(err);
  if (results.length === 0) return callback();
  callback(null);
});

```

}

I’m receiving a `[SandboxUnhandledError] mysql is not a function` error when using the prompt to test the creation of the user.

---

<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:** [June 18, 2020, 3:51pm UTC](https://community.auth0.com/t/sandboxunhandlederror-mysql-is-not-a-function-when-using-custom-database/43860/2 "2020-06-18T15:51:03Z")

</div>

I wanted to reach out and see if you were able to overcome this mysql sandbox error @kdesimini? Thanks in advance!

---

<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:** [July 2, 2020, 7:51pm UTC](https://community.auth0.com/t/sandboxunhandlederror-mysql-is-not-a-function-when-using-custom-database/43860/3 "2020-07-02T19:51:03Z")

</div>

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