MySQL

A setup for Better Auth with MySQL

Installation

Install Better Auth with MySQL, or MySQL + Redis as a secondary storage (caching).

code-editor
pnpm dlx shadcn@latest add @auth-cn/mysql

Better Auth + MySQL.

code-editor
pnpm dlx shadcn@latest add @auth-cn/mysql-redis

Better Auth + MySQL + Redis as a secondary storage (caching).

Schema Generation & Migration.

The Better Auth CLI allows you to generate and migrate your database schema based on your Better Auth configuration and installed plugins.

MySQL supports both schema generation and schema migration.

code-editor
pnpm dlx @better-auth/cli@latest generate

Generate MySQL Schema.

code-editor
pnpm dlx @better-auth/cli@latest migrate

Migrate MySQL Schema.