Registry / database / mysql-live

mysql-live

JSON →
library0.4.4jsnpmunverified

Real-time MySQL collections that auto-sync between server and client. Version 0.4.4 (latest) — stable but low activity since 2017. Uses MySQL binary logs or triggers to detect changes and pushes updates via Socket.IO. Key differentiators: server-side publish/subscribe, latency compensation (future), and collection joiners. Requires mysql-wrapper and socket.io peers. Ships TypeScript types. Ideal for apps needing live database updates without polling. Alternative to Meteor but for MySQL.

npm install mysql-live
INSTALL
IMPORT
SIG · MYSQL-LIVE
M
mysql-live
databasejavascriptv0.4.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

live
import { live } from 'mysql-live';
import live from 'mysql-live';
Named export 'live' is required; default export is not available.

Server-side setup: connect to MySQL, create a live collection for the 'users' table, and publish it via Socket.IO.

import { live } from 'mysql-live'; import http from 'http'; import express from 'express'; const app = express(); const server = http.createServer(app); const mysqlConnectionString = 'mysql://user:pass@localhost/mydb?charset=utf8'; const Mysql = live(mysqlConnectionString, server); const usersCollection = Mysql.Collection('allUsers', 'users'); Mysql.publish('allUsers', usersCollection); server.listen(3000, () => console.log('Listening on 3000'));
Debug
Known issues
gotchaThe library requires binary logging or triggers to detect changes. Without enabling MySQL binary logs (log-bin), updates may not be pushed automatically.
fix
Enable binary logging in MySQL config: log-bin=mysql-bin and set binlog_format=ROW.
affects: >=0.0.0
gotchaImport must use named import { live } from 'mysql-live'. Default import will break.
fix
Use import { live } from 'mysql-live'; with correct braces.
affects: >=0.4.0
deprecatedThe README mentions ES6 syntax but the package is CJS/ESM hybrid; TypeScript types are experimental.
fix
No current fix; consider using an alternative if stable TS support is needed.
affects: <=0.4.4
Errors
Common errors & fixes
Cannot find module 'mysql-live'
Package not installed or import path incorrect
fix
npm install mysql-live (check package.json) and use require('mysql-live') or import { live } from 'mysql-live'.
TypeError: live is not a function
Default import used instead of named import
fix
Change to import { live } from 'mysql-live';
Error: ER_BINLOG_ROW_IMAGE_FULL: Binary logging must be enabled with row-based format.
MySQL not configured for binary logging
fix
Set log-bin=mysql-bin and binlog_format=ROW in my.cnf, then restart MySQL.
Upgrade
Version history
0.4.4latest on npm
Audit
Dependencies
node-mysql-wrapperrequiredMySQL database abstraction layer that mysql-live extends
socket.iorequiredReal-time bidirectional communication for pushing live updates to clients
Agent activity
4 hits · last 30 days
node
4
Resources
mysql-live — npm install mysql-live · libregistry