A community fork of the official mysqljs/mysql package (v2.17.3) to ensure compatibility with MySQL 8 authentication and features. This package provides a pure JavaScript, no-compile MySQL driver for Node.js (>=0.6). It offers connection pooling, prepared statements, streaming, and transaction support. It is an active drop-in replacement for the original mysql package, which has been in maintenance mode. Note that the original mysql package is no longer actively maintained; the mysql8 fork addresses issues like caching_sha2_password support. However, for new projects, the mysql2 package is recommended due to better performance, promise support, and ongoing maintenance.
npm install mysql8No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to MySQL, runs a query, and logs the result. Uses ESM import and environment variable for password.
Use the mysql2 package or wrap callbacks with util.promisify.
Use `import mysql from 'mysql8'` or `const mysql = require('mysql8')`.If using TypeScript, set `esModuleInterop: true` in tsconfig.json or use `import * as mysql from 'mysql8'`.
Add `authSwitchHandler: function ({pluginName, pluginData}, cb) { ... }` to connection options, or alter MySQL user to use `mysql_native_password`.Change the user's authentication plugin: ALTER USER 'user'@'host' IDENTIFIED WITH mysql_native_password BY 'password';
Use `const mysql = require('mysql8')` or `import mysql from 'mysql8'`.Ensure connection options are correct and call `connection.connect()` before `connection.query()`.
No dependency data recorded yet.