You can use the aspnet_regsql.exe tool to execute a couple of scripts for creating (or dropping) the membership related database and database tables. These scripts ship with the .NET Framework and you can find them in the .NET Framework directory, as shown in the next picture:
The SQL scripts for installing and uninstalling SQL databases

The SQL scripts for installing and uninstalling SQL databases

Two types of scripts exist: InstallXXX and the corresponding UninstallXXX scripts. When an InstallXXX script installs a set of database tables such as the set needed for the membership API, the corresponding UninstallXXX script drops the same tables and databases. The next table describes some of the SQL scripts included with the .NET Framework.
Installs some common tables and stored procedures necessary for both the membership and roles APIs. This includes tables for identifying ASP.NET applications that use other ASP.NET features, such as the membership API, role service, or personalization.
Installs the database tables, stored procedures, and triggers used by the membership API. This includes tables for users, additional user properties, and stored procedures for accessing this information.
Installs all database tables and stored procedures required for associating users with application roles.
Contains DDL for creating any table and stored procedure required for creating personalized portal applications with web parts.
Creates all the necessary tables and stored procedures for supporting ASP.NET user profiles.
Installs tables for persistent session state in the TEMP database of SQL Server. That means every time the SQL Server service is shut down, the session state gets lost.
Installs tables for persistent session state in a separate ASPState database. That means the state stays alive even if the SQL Server service gets restarted.
If you wish you can execute these scripts by using sqlcmd.exe command-line tool, instead of aspnet_regsql.exe.
For example, to install the database tables, stored procedures, and triggers used by the membership API  on a SQL Server Express Edition, you can execute the following command:
sqlcmd -S (local)\SQLExpress -E -i InstallMembership.sql
– S switch specifies the server and instance name for the target SQL Server.
– E switch specifies access to SQL Server through Windows authentication
– i switch specifies the input SQL script that should be executed
Note: When you execute the command you will see error messages. The error messages appear because you cannot grant, revoke, or deny permissions to the system administrator (sa, db owner, or system—the administrator owns all these permissions).

C# 8.0 and .NET Core 3.0 – Modern Cross-Platform Development: Build applications with C#, .NET Core, Entity Framework Core, ASP.NET Core, and ML.NET using Visual Studio Code, 4th Edition
ASP.NET Core 3 and Angular 9: Full stack web development with .NET Core 3.1 and Angular 9, 3rd Edition
C# in Depth, 4th Edition