{"id":44036,"library":"think-model-mysql","title":"think-model-mysql","description":"MySQL adapter for ThinkJS 3.x ORM. Version 1.1.7 is stable; low release cadence. Provides MySQL-specific model operations (e.g., query building, transactions) within the ThinkJS framework. Requires think-model v3.x. Differentiator: native integration with ThinkJS, leveraging its adapter system.","status":"active","version":"1.1.7","language":"javascript","source_language":"en","source_url":"https://github.com/thinkjs/think-model-mysql","tags":["javascript","thinkjs","orm","mysql","adapter","model","typescript"],"install":[{"cmd":"npm install think-model-mysql","lang":"bash","label":"npm"},{"cmd":"yarn add think-model-mysql","lang":"bash","label":"yarn"},{"cmd":"pnpm add think-model-mysql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency; provides base model class and ORM interface","package":"think-model","optional":false}],"imports":[{"note":"CommonJS only; this package does not export ESM.","wrong":"import thinkModelMysql from 'think-model-mysql';","symbol":"thinkModelMysql","correct":"const thinkModelMysql = require('think-model-mysql');"},{"note":"Exported as property of module.exports, not destructured.","wrong":"const { MySQLAdapter } = require('think-model-mysql');","symbol":"MySQLAdapter","correct":"const MySQLAdapter = require('think-model-mysql').MySQLAdapter;"}],"quickstart":{"code":"const thinkModelMysql = require('think-model-mysql');\nconst MySQLAdapter = thinkModelMysql.MySQLAdapter;\n\n// Configure ThinkJS model with MySQL adapter\nconst model = require('think-model');\nconst mysqlConfig = {\n  handle: MySQLAdapter,\n  database: 'test',\n  prefix: 'think_',\n  encoding: 'utf8mb4'\n};\n\n// Register with ThinkJS\nthink.app.use(model(mysqlConfig));\n\n// Then use think.model('user') etc.","lang":"javascript","description":"Show how to require think-model-mysql, get MySQLAdapter, and configure it with ThinkJS model."},"warnings":[{"fix":"Use const thinkModelMysql = require('think-model-mysql');","message":"Always use require(), not import; the package does not support ESM.","severity":"gotcha","affected_versions":"all"},{"fix":"Access MySQLAdapter via require('think-model-mysql').MySQLAdapter","message":"MySQLAdapter is not directly exported as a named export; it is a property of the default export.","severity":"gotcha","affected_versions":"all"},{"fix":"Consider using an alternative ORM like Sequelize or TypeORM with ThinkJS integration.","message":"Package may be unmaintained; last release was a while ago.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"search_vec":"'1.1.7':13 '3':9 'adapt':6,45,51 'build':27 'cadenc':18 'differenti':38 'e.g':25 'framework':32 'integr':40 'javascript':47 'leverag':43 'low':16 'model':3,23,36,52 'mysql':4,5,21,50 'mysql-specif':20 'nativ':39 'oper':24 'orm':11,49 'provid':19 'queri':26 'releas':17 'requir':33 'specif':22 'stabl':15 'system':46 'think':2,35 'think-model':34 'think-model-mysql':1 'thinkj':8,31,42,48 'transact':28 'typescript':53 'v3.x':37 'version':12 'within':29 'x':10","created_at":"2026-06-05T17:02:40.050331+00:00","updated_at":"2026-06-05T17:02:40.050331+00:00","problems":[{"fix":"Run npm install think-model-mysql --save","cause":"Package not installed or missing from node_modules.","error":"Cannot find module 'think-model-mysql'"},{"fix":"Use const thinkModelMysql = require('think-model-mysql');","cause":"Importing the package incorrectly (e.g., using import instead of require).","error":"TypeError: thinkModelMysql is not a constructor"},{"fix":"Use const MySQLAdapter = require('think-model-mysql').MySQLAdapter;","cause":"Attempting to destructure MySQLAdapter from require result incorrectly.","error":"Cannot read property 'MySQLAdapter' of undefined"}],"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/thinkjs/think-model-mysql#readme","github":"https://github.com/thinkjs/think-model-mysql","docs":null,"changelog":null,"pypi":null,"npm":"think-model-mysql","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}}