{"id":42720,"library":"execsql","title":"execsql","description":"A CLI tool and Node.js library for executing SQL files or inline statements, primarily for database initialization. Version 0.0.3 is the latest (and only) release, with no active development since 2014. It uses callbacks, runs on Node.js only, and connects to MySQL. Minimal error handling and no tests.","status":"abandoned","version":"0.0.3","language":"javascript","source_language":"en","source_url":"git@github.com:node-fun/execsql","tags":["javascript","mysql","execsql","initsql"],"install":[{"cmd":"npm install execsql","lang":"bash","label":"npm"},{"cmd":"yarn add execsql","lang":"bash","label":"yarn"},{"cmd":"pnpm add execsql","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for MySQL database connectivity.","package":"mysql","optional":false}],"imports":[{"note":"CommonJS only; ES module import not supported.","wrong":"import execsql from 'execsql'","symbol":"default","correct":"const execsql = require('execsql')"},{"note":"Config method expects an object with host, user, password properties.","wrong":"execsql.config({host, user, password})","symbol":"config","correct":"execsql.config(dbConfig)"},{"note":"Executes a SQL string.","symbol":"exec","correct":"execsql.exec(sql)"},{"note":"Executes a .sql file; takes a callback (err, results).","symbol":"execFile","correct":"execsql.execFile(filename, callback)"}],"quickstart":{"code":"var execsql = require('execsql'),\n    dbConfig = {\n        host: process.env.DB_HOST ?? 'localhost',\n        user: process.env.DB_USER ?? 'root',\n        password: process.env.DB_PASS ?? ''\n    },\n    sqlFile = __dirname + '/init.sql';\nexecsql\n    .config(dbConfig)\n    .exec('CREATE DATABASE IF NOT EXISTS test')\n    .execFile(sqlFile, function(err, results) {\n        if (err) console.error(err);\n        else console.log(results);\n    })\n    .end();","lang":"javascript","description":"Shows how to configure database connection, execute inline SQL, and run a .sql file with a callback."},"warnings":[{"fix":"Consider migrating to mysql2 or sequelize for modern projects.","message":"Requires Node.js and MySQL; no longer maintained since 2014.","severity":"breaking","affected_versions":"0.0.3"},{"fix":"Wrap calls in a Promise or use promisify.","message":"The package uses the old callback pattern and is not promise-based.","severity":"deprecated","affected_versions":">=0.0.1"},{"fix":"Always chain .end() after exec/execFile calls.","message":"execsql.end() must be called to close the connection.","severity":"gotcha","affected_versions":">=0.0.1"}],"env_vars":null,"search_vec":"'0.0.3':20 '2014':32 'activ':29 'callback':35 'cli':3 'connect':41 'databas':17 'develop':30 'error':45 'execsql':1,52 'execut':9 'file':11 'handl':46 'initi':18 'initsql':53 'inlin':13 'javascript':50 'latest':23 'librari':7 'minim':44 'mysql':43,51 'node.js':6,38 'primarili':15 'releas':26 'run':36 'sinc':31 'sql':10 'statement':14 'test':49 'tool':4 'use':34 'version':19","created_at":"2026-06-05T16:56:20.892456+00:00","updated_at":"2026-06-05T16:56:20.892456+00:00","problems":[{"fix":"Run 'npm install mysql'","cause":"Missing mysql dependency in package.json of user's project.","error":"Error: Cannot find module 'mysql'"},{"fix":"Use 'const execsql = require(\"execsql\")' (CommonJS).","cause":"Using default import with ES modules or incorrect require.","error":"TypeError: execsql.config is not a function"},{"fix":"Check host, user, password; ensure MySQL is running and credentials are correct.","cause":"Wrong database credentials in config.","error":"Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'"}],"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/node-fun/execsql","github":"git@github.com:node-fun/execsql","docs":null,"changelog":null,"pypi":null,"npm":"execsql","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}}