{"id":43290,"library":"mysql-kit","title":"MySQL-Kit","description":"A lightweight MySQL toolkit built on top of the `mysql` npm package that provides promisified query methods and common CRUD shorthand operations (find, findOne, insert, update, etc.). Current stable version is 0.3.0 with a low release cadence (last release Sep 2019). Key differentiators: minimal abstraction over raw `mysql` queries, synchronous-looking async API, and built-in helper methods for common operations. Does not use connection pooling natively (delegates to `mysql`). Suitable for simple scripts or small projects needing a thin wrapper.","status":"active","version":"0.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/4074/mysql-kit","tags":["javascript"],"install":[{"cmd":"npm install mysql-kit","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-kit","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-kit","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency – the underlying MySQL driver; must be installed separately.","package":"mysql","optional":false},{"reason":"Optional dev dependency for TypeScript type definitions.","package":"@types/mysql","optional":true}],"imports":[{"note":"Default export – named import will not work.","wrong":"import { connect } from 'mysql-kit'","symbol":"connect","correct":"import connect from 'mysql-kit'"},{"note":"query is a named export; must be used after connecting.","wrong":"import { query } from 'mysql-kit' (missing default import for connect)","symbol":"query","correct":"import connect, { query } from 'mysql-kit'"},{"note":"Named exports for helper methods; requires connection first.","wrong":"const { findOneById } = require('mysql-kit') (CJS require may not work with ESM-style bundle)","symbol":"findOneById","correct":"import connect, { findOneById } from 'mysql-kit'"}],"quickstart":{"code":"import connect, { query, findOneById } from 'mysql-kit';\n\nconst config = {\n  host: process.env.DB_HOST ?? 'localhost',\n  user: process.env.DB_USER ?? 'root',\n  password: process.env.DB_PASS ?? '',\n  database: process.env.DB_NAME ?? 'test',\n};\n\nawait connect(config);\nconst tables = await query('SHOW TABLES');\nconsole.log('Tables:', tables);\n\n// Shorthand example\nconst row = await findOneById('users', 1);\nconsole.log('User:', row);","lang":"typescript","description":"Demonstrates connecting to MySQL, executing a raw query, and using a shorthand method to find a row by ID."},"warnings":[{"fix":"Use `await connect(config)` instead of `connect(config)`.","message":"Version 0.2.0 included a breaking change: `connect` is now async and must be awaited.","severity":"gotcha","affected_versions":">=0.2.0"},{"fix":"Call `connect` only once at startup, or add explicit connection management if needed.","message":"The `query` function is not a connection pool manage – it uses the last connection created by `connect`. Calling `connect` again reinitializes the active connection.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to >=0.3.0 or cast return types manually.","message":"TypeScript types for helper methods like `findOneById` may not be exported in all versions; check TypeScript definitions.","severity":"gotcha","affected_versions":"<0.3.0"},{"fix":"Always wrap calls in try/catch or use .catch().","message":"The `mysql` package is used directly without any promise-based wrapper – errors from `mysql` are not caught unless explicitly handled in query promises.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'0.3.0':35 '2019':44 'abstract':48 'api':57 'async':56 'built':8,60 'built-in':59 'cadenc':40 'common':22,65 'connect':70 'crud':23 'current':31 'deleg':73 'differenti':46 'etc':30 'find':26 'findon':27 'helper':62 'insert':28 'javascript':87 'key':45 'kit':3 'last':41 'lightweight':5 'look':55 'low':38 'method':20,63 'minim':47 'mysql':2,6,13,51,75 'mysql-kit':1 'nativ':72 'need':83 'npm':14 'oper':25,66 'packag':15 'pool':71 'project':82 'promisifi':18 'provid':17 'queri':19,52 'raw':50 'releas':39,42 'script':79 'sep':43 'shorthand':24 'simpl':78 'small':81 'stabl':32 'suitabl':76 'synchron':54 'synchronous-look':53 'thin':85 'toolkit':7 'top':10 'updat':29 'use':69 'version':33 'wrapper':86","created_at":"2026-06-05T16:59:05.593558+00:00","updated_at":"2026-06-05T16:59:05.593558+00:00","problems":[{"fix":"Ensure `await connect(config)` is executed before any query or helper method.","cause":"Calling `query()` without first calling and awaiting `connect()`.","error":"Error: connect must be called before query"},{"fix":"Install correct peer dependency: `npm install mysql`.","cause":"Missing or incorrect version of `mysql` peer dependency (e.g., `mysql2` instead of `mysql`).","error":"TypeError: mysql.createConnection is not a function"},{"fix":"Run `npm install mysql mysql-kit` and ensure tsconfig has `\"moduleResolution\": \"node\"`.","cause":"Package not installed or TypeScript cannot resolve module.","error":"Cannot find module 'mysql-kit'"}],"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/4074/mysql-kit#readme","github":"https://github.com/4074/mysql-kit","docs":null,"changelog":null,"pypi":null,"npm":"mysql-kit","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"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}}