> ## Documentation Index
> Fetch the complete documentation index at: https://docs-staging-quickstart-revamp.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Learn how to create and use a database connection using either the Auth0 user store or your own user store.

# Database Connections

Auth0 provides database connections to authenticate users with an identifier (email, username, or phone number) and password. These credentials are securely stored in the Auth0 user store or in your own database.

You can create a new database connection and manage existing ones at [Auth0 Dashboard > Authentication > Database](https://manage.auth0.com/#/connections/database):

## Scenarios

<Tabs>
  <Tab title="Auth0 user store">
    Auth0 provides the database infrastructure to store your users by default. This scenario provides the best performance for the authentication process since all data is stored in Auth0.

    The Auth0-hosted database is highly secure. Passwords are never stored or logged in plain text but are hashed with **bcrypt**. Varying levels of password security requirements can also be enforced. To learn more, read [Password Strength in Auth0 Connections](/docs/authenticate/database-connections/password-strength).

    <Callout icon="file-lines" color="#0EA5E9" iconType="regular">
      For database connections, Auth0 limits the number of repeat login attempts per user and IP address. To learn more, read [User/Password Authentication Rate Limits](/docs/troubleshoot/customer-support/operational-policies/rate-limit-policy/database-connections-rate-limits).
    </Callout>
  </Tab>

  <Tab title="Your own user store">
    If you have an existing user store, or wish to store user credentials on your own server, Auth0 enables you to connect to a [custom database](/docs/authenticate/database-connections/custom-db) or repository and use it as the identity provider.

    <Frame>
      <img src="https://mintcdn.com/docs-staging-quickstart-revamp/TO6FS4AgTzQGgpsU/images/cdy7uua7fh8z/3SNKwx0KzkUwbodqUQbtvW/df720f8871b56dd7ec399a24aa621c36/2025-02-20_16-50-04.png?fit=max&auto=format&n=TO6FS4AgTzQGgpsU&q=85&s=0221f910c023f53a938cdf456118e1e8" alt="" width="900" height="1067" data-path="images/cdy7uua7fh8z/3SNKwx0KzkUwbodqUQbtvW/df720f8871b56dd7ec399a24aa621c36/2025-02-20_16-50-04.png" />
    </Frame>

    In this scenario, you provide the login script to authenticate the user that will execute each time a user attempts to log in. Optionally, you can [create scripts](/docs/authenticate/database-connections/custom-db/templates) for sign-up, email verification, password reset, and delete user functionality.

    The scripts are Node.js code. Auth0 provides [templates](/docs/authenticate/database-connections/custom-db/templates) for most common databases, such as ASP.NET Membership Provider, MongoDB, MySQL, PostgreSQL, SQL Server, Windows Azure SQL Database, and for a web service accessed by Basic Auth. Essentially, you can connect to almost any kind of database or web service with a custom script.

    <Warning>
      Only tenants created prior to 17 July 2018 have access to Webtask.io and the Webtask CLI. If you are an enterprise customer with a newer tenant, please contact your account representative to request access. Other requests can be made through the [Auth0 Contact Form](https://auth0.com/get-started?place=documentation%20post\&type=link\&text=auth0%20contact%20form) and will be evaluated on a case-by-case basis.
    </Warning>
  </Tab>

  <Tab title="Migrating to Auth0">
    In this scenario, you have a legacy user store and wish to switch to the Auth0 store. Auth0 provides an automatic migration feature that adds your users to the Auth0 database one-at-a-time as each logs in and avoids asking your users to reset their passwords all at the same time. To learn more, read [Configure Automatic Migration from Your Database](/docs/manage-users/user-migration/configure-automatic-migration-from-your-database).
  </Tab>

  <Tab title="Requiring a username">
    1. Go to [**Auth0 Dashboard > Authentication > Database**](https://manage.auth0.com/#/connections/database), and select the name of the connection you want to edit.
    2. Locate **Requires Username**, and use the toggle to enable or disable requiring a username.

           <Frame>
             <img src="https://mintcdn.com/docs-staging-quickstart-revamp/AmyDKn5Na0kFZtbL/images/cdy7uua7fh8z/1MlOrFmcSCOCRYKRxWz6xT/7a87dac16a31cbb6e608489c5843d6c7/2025-02-25_12-02-23.png?fit=max&auto=format&n=AmyDKn5Na0kFZtbL&q=85&s=8a09db16043dff9d130edc225632facf" alt="Enable or disable require username setting" width="899" height="569" data-path="images/cdy7uua7fh8z/1MlOrFmcSCOCRYKRxWz6xT/7a87dac16a31cbb6e608489c5843d6c7/2025-02-25_12-02-23.png" />
           </Frame>

    To see how this will affect the login screen, select the **Try Connection** view. Notice that once **Requires Username** is enabled, new users must enter a username and their email address to sign up.

    <Frame>
      <img src="https://mintcdn.com/docs-staging-quickstart-revamp/cn1eMmAiJHX3hF4T/images/cdy7uua7fh8z/AiB37UZqyBPb8h55PZtzm/73e6fd0033f63f865c40f189db1620ef/2025-01-29_15-22-11.png?fit=max&auto=format&n=cn1eMmAiJHX3hF4T&q=85&s=c82c5a5e589ff691bc47a209fc349397" alt="Login form with username" width="398" height="677" data-path="images/cdy7uua7fh8z/AiB37UZqyBPb8h55PZtzm/73e6fd0033f63f865c40f189db1620ef/2025-01-29_15-22-11.png" />
    </Frame>

    Users can then login with either their username or their email address. Users who registered while **Requires Username** was disabled will not have a Username field stored and will have to log in with their email address.
  </Tab>
</Tabs>

## Learn more

* [Manage Users](/docs/manage-users)
