Egg.js MySQL plugin based on mysql2, providing connection pool management and a simple API wrapper (select, insert, update, delete). Version 1.1.15 supports egg 2.x and 3.x (not 1.x). Key features: optional camelCase field conversion (v1.1.7+), timezone and dateStrings options (v1.1.14+), built-in transaction support, and automatic SQL execution time logging in development. Distinguishes from egg-mysql by being based on mysql2, offering camelCase conversion, and stricter Node.js version requirement (>=16).
npm install ruoyi-eggjs-mysqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows plugin configuration, single-instance client setup, and a simple select query with parameterized SQL.
Upgrade Node.js to >=16 and egg to 2.x or 3.x.
If you enable camelCase, update all field references from snake_case to camelCase.
Add dateStrings: false to mysql config for Date object returns.
Always use ? for parameters. For named placeholders, use a separate library.
Do not call app.mysql.end() or similar; pool lifecycle is automatic.
Ensure plugin is enabled in config/plugin.js and mysql config is set in config/config.default.js
Check MYSQL_HOST environment variable or config; ensure MySQL server is running and accessible.
Verify MYSQL_USER, MYSQL_PASSWORD, and that the user has access to the specified database.