mysql-node-migrator is a lightweight database migration tool for Node.js and MySQL, currently at version 1.3.0 (stable, low release cadence). It manages SQL change scripts in a folder, tracking executed migrations in a `migration_schema` table. Unlike more complex tools like Knex or Sequelize migrations, it focuses on simplicity: plain SQL files named with a version prefix (e.g., V1__init.sql), automatic execution order, and no rollback support. It wraps promise-mysql (which wraps mysqljs/mysql) and works only with `.createConnection()`, limiting advanced connection pooling. Best suited for small projects or teams wanting minimal migration overhead.
npm install mysql-node-migratorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import and run migrations with mysql-node-migrator using ESM syntax, environment variables for credentials, and a migrations folder.
Use import syntax or set type: module in package.json.
Use a different migration library if you need connection pooling.
Name files accordingly, e.g., V1__init.sql, V2__add_users.sql.
Manually write reverse SQL scripts or use another tool for rollbacks.
Use .then().catch() or wrap in async function using await.
Change to import syntax: import migrator from 'mysql-node-migrator';.
Ensure you use default import: import migrator from 'mysql-node-migrator'; (no curly braces).