Using MySQL as identity provider in ASP.NET

  
  • Add AspNet.Identity.MySQL from NuGet or GitHub to your project.

  • Add MySql.Data from NuGet to your project.

  • Add a MySQL schema and create the tables

  • Apply changes (or here and here) to your project

  • Change connection string to
    <add name="DefaultConnection" connectionString="Server=localhost;Port=3306;Database=<schema_name>;
    Uid=<username>;Pwd=<password>;" providerName="MySql.Data.MySqlClient" />
  • in case of a null reference exception, use
    var manager = new ApplicationUserManager(new UserStore<ApplicationUser>(new MySQLDatabase("AuthConnection")));