# Custom Database and Wordpress

**URL:** <https://community.auth0.com/t/custom-database-and-wordpress/6187>\
**Category:** Get Help\
**Tags:** custom-database\
**Created:** [April 11, 2017, 8:23pm UTC](https://community.auth0.com/t/custom-database-and-wordpress/6187 "2017-04-11T20:23:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dave1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@dave1](https://community.auth0.com/u/dave1)\
**Post date:** [April 11, 2017, 8:23pm UTC](https://community.auth0.com/t/custom-database-and-wordpress/6187/1 "2017-04-11T20:23:00Z")

</div>

I am trying to implement Auth0 on my wordpress install.  
I am using the WP plugin, and it works if I use the Auth0 DB and add a username and password manually.

What I want to happen is that everytime a user logs in for the first time, that Auth0 checks my WP database for validation and if successful moves the information up to the Auth0 database.

My questions:

1. Can this be done through settings within the Wordpress Plugin and Auth0 dashboard?
2. If no, is the solution to set up connection through custom database?
3. If yes, I am trying to set up connection with custom database, have it connecting but am getting the following error mysql login script error: “data and hash arguments required” Any idea what the error means or how to fix?

---

<div class="post-metadata">

**Author:** ![prashantT](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/prashantt/32/6002_2.png) [@prashantT](https://community.auth0.com/u/prashantT)\
**Post date:** [April 12, 2017, 10:00am UTC](https://community.auth0.com/t/custom-database-and-wordpress/6187/2 "2017-04-12T10:00:47Z")

</div>

To achieve your desired behaviour, you would use a [Custom Database](https://auth0.com/docs/connections/database/mysql), with `Import Users to Auth0` enabled in the connection settings (Auth0 Dashboard). With this, when a user logs in, it will authenticate against your custom database, and on successful login, import the user to Auth0. All successive login attempts by that user will only authenticate against the Auth0 user.

The error you are seeing seems to be specific to the following line:

```
if (!bcrypt.compareSync(password, user.password)){...

```

Either the `password` parameter, or the `user.password` parameter are null or undefined. You can debug this by using a `console.log` statement for each of these parameters before the execution of the compare, and see whether they are defined.

---

<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:** [March 2, 2018, 5:53am UTC](https://community.auth0.com/t/custom-database-and-wordpress/6187/3 "2018-03-02T05:53:13Z")

</div>


