{"id":38009791,"url":"https://github.com/alsey/nodejs-mysql","last_synced_at":"2026-01-16T19:19:31.264Z","repository":{"id":57311938,"uuid":"73886895","full_name":"alsey/nodejs-mysql","owner":"alsey","description":"The wrapper of Node.js MySQL driver with Promise enabled.","archived":false,"fork":false,"pushed_at":"2017-11-23T05:42:08.000Z","size":27,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-08T09:14:19.393Z","etag":null,"topics":["mysql","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alsey.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-16T05:21:30.000Z","updated_at":"2023-02-22T00:24:16.000Z","dependencies_parsed_at":"2022-09-10T22:11:51.621Z","dependency_job_id":null,"html_url":"https://github.com/alsey/nodejs-mysql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/alsey/nodejs-mysql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsey%2Fnodejs-mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsey%2Fnodejs-mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsey%2Fnodejs-mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsey%2Fnodejs-mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alsey","download_url":"https://codeload.github.com/alsey/nodejs-mysql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alsey%2Fnodejs-mysql/sbom","scorecard":{"id":186916,"data":{"date":"2025-08-11","repo":{"name":"github.com/alsey/nodejs-mysql","commit":"c678d1ea5e69689eafffee0acfa15867fbe5f090"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/15 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}}]},"last_synced_at":"2025-08-16T19:57:17.293Z","repository_id":57311938,"created_at":"2025-08-16T19:57:17.294Z","updated_at":"2025-08-16T19:57:17.294Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28481671,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mysql","nodejs"],"created_at":"2026-01-16T19:19:31.154Z","updated_at":"2026-01-16T19:19:31.256Z","avatar_url":"https://github.com/alsey.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nodejs-mysql\n\n  The wrapper of Node.js MySQL driver with Promise enabled.\n\n  [![NPM Version][npm-image]][npm-url]\n  [![NPM Downloads][downloads-image]][downloads-url]\n  [![Linux Build][travis-image]][travis-url]\n  [![Windows Build][appveyor-image]][appveyor-url]\n  [![Test Coverage][coveralls-image]][coveralls-url]\n\n[![NPM](https://nodei.co/npm/nodejs-mysql.png?compact=true)](https://nodei.co/npm/nodejs-mysql/)\n\n```js\nimport mysql from 'nodejs-mysql'\n\nconst db = mysql.getInstance(config)\n\ndb.exec('select col1, col2 from a_table')\n        .then(rows =\u003e res.ok(rows))\n        .catch(e =\u003e res.err(e)))\n```\n\n## Installation\n\n```bash\n$ npm install nodejs-mysql\n```\n\n## Demo\n\nFolder `demo` includes a simple demo of both [ES5](https://github.com/alsey/nodejs-mysql/blob/master/demo/simple_es5.js) and [ES6](https://github.com/alsey/nodejs-mysql/blob/master/demo/simple_es6.js). \n\n## How to Use\n\nUse config object to describe database connection(s).\n\n```javascript\n// single database connection\nconst config = {\n    host: '192.168.0.100',\n    port: 3306,\n    user: 'root',\n    password: 'password',\n    database: 'testdb'\n}\n\n// database connection pool\nconst config = [\n    {\n        host: '192.168.0.101',\n        port: 3306,\n        user: 'root',\n        password: 'password',\n        database: 'testdb',\n        dateStrings: true,\n        debug: false\n    },{\n        host: '192.168.0.102',\n        port: 3306,\n        user: 'root',\n        password: 'password',\n        database: 'testdb',\n        dateStrings: true,\n        debug: false\n    },{\n        host: '192.168.0.103',\n        port: 3306,\n        user: 'root',\n        password: 'password',\n        database: 'testdb',\n        dateStrings: true,\n        debug: false\n    }\n]\n```\n\nGet instance in anywhere before do database operations.\n\n```javascript\nimport mysql from 'nodejs-mysql'\n\nconst db = mysql.getInstance(config)\n```\n\n**Attention** If you are not using ES6, import package like this,\n\n```javascript\nconst mysql = require('nodejs-mysql').default;\n```\n\nMethod `exec` for all database operation, close database connection is not need.\n\n```javascript\n// select\ndb.exec('select col1, col2 from a_table')\n        .then(rows =\u003e {\n            // do sth. with result in rows\n        })\n        .catch(e =\u003e {\n            // handle errors\n        })\n\n// insert\ndb.exec('insert into a_table set ?', {\n            col1: value1,\n            col2: value2\n        })\n        .then(rows =\u003e {\n            // no error, insert ok\n        })\n        .catch(e =\u003e {\n            // insert failed, handle errors\n        })\n        \n// update\ndb.exec('update a_table set col1 = ?, col2 = ?', [value1, value2])\n        .then(rows =\u003e {\n            // no error, update ok\n        })\n        .catch(e =\u003e {\n            // update failed, handle errors\n        })\n\n// delete\ndb.exec('delete from a_table where col1 = ?', [value1])\n        .then(rows =\u003e {\n            // no error, delete ok\n        })\n        .catch(e =\u003e {\n            // delete failed, handle errors\n        })\n```\n\n`nodejs-mysql` also support transaction. Transaction code like this,\n\n```javascript\ndb.connect()\n  .then(conn =\u003e db.trans(conn))\n  .then(conn =\u003e db.query(sql, params, conn))\n  .then((rows, conn) =\u003e {\n    // do sth. with the result in rows\n    return db.query(sql2, params2, conn)\n  })\n  .then((rows, conn) =\u003e {\n    // do sth. with the result2 in rows\n    if (condition)\n      return db.query(sql3, params3, conn)\n    else\n      return db.ok(rows) // \u003c-- directly put result to next\n  })\n  .then((rows, conn) =\u003e {\n    // do sth. with the result3 in rows\n    return db.commit(conn)\n  })\n  .catch(e =\u003e {\n    // handle errors\n  })\n```\n## License\n\n  [MIT](LICENSE)\n\n\n[npm-image]: https://badge.fury.io/js/nodejs-mysql.svg\n[npm-url]: https://npmjs.org/package/nodejs-mysql\n[downloads-image]: https://img.shields.io/npm/dm/nodejs-mysql.svg\n[downloads-url]: https://npmjs.org/package/nodejs-mysql\n[travis-image]: https://img.shields.io/travis/alsey/nodejs-mysql/master.svg?label=linux\n[travis-url]: https://travis-ci.org/alsey/nodejs-mysql\n[appveyor-image]: https://img.shields.io/appveyor/ci/alsey/nodejs-mysql/master.svg?label=windows\n[appveyor-url]: https://ci.appveyor.com/project/alsey/nodejs-mysql\n[coveralls-image]: https://img.shields.io/coveralls/alsey/nodejs-mysql/master.svg\n[coveralls-url]: https://coveralls.io/r/alsey/nodejs-mysql?branch=master\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falsey%2Fnodejs-mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falsey%2Fnodejs-mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falsey%2Fnodejs-mysql/lists"}