mysql-schema-ts (v1.9.1) is a CLI tool and library that connects to a MySQL database and generates TypeScript interfaces from its schema. It provides simple, opinionated defaults with no configuration files, focusing on MySQL only. It can infer entire schemas or specific tables, supports CLI usage via npx, and also offers programmatic use with inferSchema and inferTable functions. Unlike alternatives like schemats, it avoids namespaces and uses inline enums. The package is stable but in maintenance mode with infrequent updates.
npm install mysql-schema-tsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows both CLI and programmatic usage to generate TypeScript interfaces from a MySQL database schema.
Manually adjust generated interface to use bigint if needed.
Consider using schemats or other actively maintained libraries.
Be aware of renamed columns in generated code; no way to customize transformation.
Update to use async/await or .then().
Ensure connection string starts with 'mysql://'.
Run 'npm install mysql-schema-ts' or use 'npx mysql-schema-ts' without installation.
Ensure MySQL server is running and accessible; use correct host/port.
Provide correct username/password; ensure user has SELECT on information_schema.
Use import { inferSchema } from 'mysql-schema-ts' or use dynamic import.