{"id":44119,"library":"wait-for-mysql","title":"wait-for-mysql","description":"A Node.js utility that polls a MySQL server until a connection is available, with optional custom query validation. Version 1.0.0 is the current stable release; no further updates have been published since its initial release. It supports both programmatic use and CLI invocation, but has no active maintenance or release cadence. Unlike more modern tools (e.g., wait-on, docker-compose healthchecks), this package is minimal, single-purpose, and does not support ESM or TypeScript natively.","status":"maintenance","version":"1.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/joeledwards/node-wait-for-mysql","tags":["javascript","MySQL","Notify","Event"],"install":[{"cmd":"npm install wait-for-mysql","lang":"bash","label":"npm"},{"cmd":"yarn add wait-for-mysql","lang":"bash","label":"yarn"},{"cmd":"pnpm add wait-for-mysql","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM syntax works if you use a module bundler or Node.js with ESM, but the package itself is CJS only. In CommonJS, use require().","wrong":"const waitForMy = require('wait-for-mysql')","symbol":"default","correct":"import waitForMy from 'wait-for-mysql'"},{"note":"The named export 'wait' is the main function. Default import gives the same object, but this is explicit.","wrong":"import wait from 'wait-for-mysql'","symbol":"wait","correct":"import { wait } from 'wait-for-mysql'"},{"note":"No TypeScript types are shipped; this is a conceptual type only if you define it yourself.","wrong":"import { WaitConfig } from 'wait-for-mysql'","symbol":"WaitConfig","correct":"import type { WaitConfig } from 'wait-for-mysql'"}],"quickstart":{"code":"import { wait } from 'wait-for-mysql';\n\nconst config = {\n  host: process.env.MYSQL_HOST ?? 'localhost',\n  port: parseInt(process.env.MYSQL_PORT ?? '3306'),\n  username: process.env.MYSQL_USER ?? 'root',\n  password: process.env.MYSQL_PASSWORD ?? '',\n  database: process.env.MYSQL_DATABASE ?? 'test',\n  query: 'SELECT 1',\n  quiet: false\n};\n\nwait(config).then(() => {\n  console.log('MySQL is ready');\n}).catch(err => {\n  console.error('MySQL never became available:', err);\n});\n","lang":"typescript","description":"Waits for MySQL to accept connections, then runs a validation query."},"warnings":[{"fix":"Consider using a more maintained alternative like wait-on or a simple loop with mysql2.","message":"The package is not updated for newer Node.js versions; may fail silently with Node >= 14.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Switch to mysql2 directly and implement your own polling.","message":"Uses mysql (MySQL2) under the hood, which is deprecated in favor of mysql2.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use npx or run via node_modules/.bin/wait-for-mysql.","message":"The CLI binary 'wait-for-mysql' may conflict with other packages on PATH.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.0':24 'activ':51 'avail':17 'cadenc':55 'cli':46 'compos':66 'connect':15 'current':27 'custom':20 'docker':65 'docker-compos':64 'e.g':60 'esm':79 'event':86 'healthcheck':67 'initi':38 'invoc':47 'javascript':83 'mainten':52 'minim':71 'modern':58 'mysql':4,11,84 'nativ':82 'node.js':6 'notifi':85 'option':19 'packag':69 'poll':9 'programmat':43 'publish':35 'purpos':74 'queri':21 'releas':29,39,54 'server':12 'sinc':36 'singl':73 'single-purpos':72 'stabl':28 'support':41,78 'tool':59 'typescript':81 'unlik':56 'updat':32 'use':44 'util':7 'valid':22 'version':23 'wait':2,62 'wait-for-mysql':1 'wait-on':61","created_at":"2026-06-05T17:03:03.939915+00:00","updated_at":"2026-06-05T17:03:03.939915+00:00","problems":[{"fix":"Run 'npm install mysql' alongside wait-for-mysql.","cause":"The package depends on 'mysql' which may not be installed.","error":"Error: Cannot find module 'mysql'"},{"fix":"Use 'import { wait } from 'wait-for-mysql'' or use CommonJS require().","cause":"Using default import instead of named import in ESM.","error":"TypeError: waitForMy.wait is not a function"},{"fix":"Ensure MySQL is started and config host/port match your server.","cause":"MySQL is not running or host/port is wrong.","error":"Error: connect ECONNREFUSED 127.0.0.1:3306"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/joeledwards/node-wait-for-mysql#readme","github":"https://github.com/joeledwards/node-wait-for-mysql","docs":null,"changelog":null,"pypi":null,"npm":"wait-for-mysql","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-05","next_check":"2026-09-03","install_tag":null}}