{"id":43311,"library":"mysql-next","title":"mysql-next","description":"A fast, feature-rich MySQL client for Node.js (v0.1.0) leveraging ES6 tagged template literals for parameterized queries. Provides connection pooling, TLS, prepared statement caching, and TypeScript types. Released as an early-stage package targeting modern Node.js >=20.11.0. Compared to mysql2, it offers a simpler API with automatic parameter binding and insert/update helpers, but is newer and less battle-tested.","status":"active","version":"0.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/luas10c/mysql-next","tags":["javascript","driver","mysql","database","fast","secure","typescript"],"install":[{"cmd":"npm install mysql-next","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-next","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-next","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; CommonJS require is not supported.","wrong":"const mysql = require('mysql-next')","symbol":"default","correct":"import mysql from 'mysql-next'"},{"note":"The default export is a function; you call it to create a sql tag.","wrong":"import { mysql } from 'mysql-next'","symbol":"sql","correct":"import mysql from 'mysql-next'; const sql = mysql('...')"},{"note":"Types are bundled; Sql type represents the tagged template function.","wrong":"","symbol":"TypeScript types","correct":"import type { Sql } from 'mysql-next'"}],"quickstart":{"code":"import mysql from 'mysql-next'\nimport 'dotenv/config'\n\nconst sql = mysql(process.env.MYSQL_URL ?? 'mysql://root:password@localhost:3306/app', {\n  max: 10,\n  idleTimeout: 30_000,\n  acquireTimeout: 30_000,\n  prepare: true,\n  maxStatements: 100\n})\n\nconst users = await sql`\n  select id, name, age\n  from users\n  where age > ${60}\n`\n\nconsole.log(users)\n\nconst result = await sql`\n  insert into users ${sql({ name: 'Murray', age: 68 })}\n`\n\nconsole.log('Inserted ID:', result.lastInsertId)\n\nawait sql.end()","lang":"typescript","description":"Shows connection using URL, parameterized select query, and insert helper with automatic object-to-column mapping."},"warnings":[{"fix":"Upgrade Node.js to version 20.11.0 or later.","message":"Node.js >=20.11.0 required","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Use ${value} without quotes; the driver handles escaping.","message":"Do not quote interpolated values in queries – they are automatically bound as parameters.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set 'prepare: false' or adjust 'maxStatements' for workloads with many ad-hoc queries.","message":"The 'prepare' option defaults to true; performance may degrade if many distinct queries are used without proper statement caching.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'20.11.0':42 'api':50 'automat':52 'battl':64 'battle-test':63 'bind':54 'cach':28 'client':10 'compar':43 'connect':23 'databas':69 'driver':67 'earli':36 'early-stag':35 'es6':15 'fast':5,70 'featur':7 'feature-rich':6 'helper':57 'insert/update':56 'javascript':66 'less':62 'leverag':14 'liter':18 'modern':40 'mysql':2,9,68 'mysql-next':1 'mysql2':45 'newer':60 'next':3 'node.js':12,41 'offer':47 'packag':38 'paramet':53 'parameter':20 'pool':24 'prepar':26 'provid':22 'queri':21 'releas':32 'rich':8 'secur':71 'simpler':49 'stage':37 'statement':27 'tag':16 'target':39 'templat':17 'test':65 'tls':25 'type':31 'typescript':30,72 'v0.1.0':13","created_at":"2026-06-05T16:59:11.632488+00:00","updated_at":"2026-06-05T16:59:11.632488+00:00","problems":[{"fix":"Change to import syntax: `import mysql from 'mysql-next'`","cause":"Attempting to load the package with CommonJS require().","error":"Error: The 'mysql-next' package is ESM-only. Use `import` instead of `require`."},{"fix":"Ensure Node.js version is 20.11.0 or higher.","cause":"The installed mysql-next version does not match Node.js >=20.11.0 requirement.","error":"TypeError: Class extends value undefined is not a constructor or null"}],"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/luas10c/mysql-next","github":"https://github.com/luas10c/mysql-next","docs":null,"changelog":null,"pypi":null,"npm":"mysql-next","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}}