like-mysql is a simple, intuitive ORM for MySQL built on top of mysql2. Version 2.0.2 provides a promise-based API with automatic SQL query building for common operations like insert, select, update, delete, exists, and count. It supports transactions with a callback pattern and prepared statements by default. Key differentiators: minimal configuration, automatic WHERE handling, and integration with like-sql for query generation. Release cadence is low; the package has not seen updates since 2020. Compared to Sequelize or TypeORM, it offers a lightweight, no-frills experience with fewer features but lower complexity.
npm install like-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a connection pool, wait for readiness, insert a row, select rows, and close the pool.
Consider using a maintained alternative like Sequelize, TypeORM, or mysql2 directly.
Use string arguments in order: 'host:port', 'user', 'password', 'database'. For socketPath, pass path as first argument.
Always prefix non-WHERE clauses with the appropriate keyword (e.g., 'ORDER BY ...').
Use conn.insert, conn.select, etc. inside transaction callback as shown in README.
Use CommonJS require: const mysql = require('like-mysql');Ensure MySQL is running on the specified host:port, or provide correct credentials.
Ensure you call mysql() to create db first, then await db.ready(). Check import is correct.
Verify column names in your select/insert/update calls match the database schema.