{"id":43355,"library":"mysql-server","title":"mysql-server","description":"A Node.js package that provides an isolated, portable MySQL server (or MariaDB) for development and testing. It bundles MySQL binaries and automatically manages starting and stopping a local instance without requiring a separate MySQL installation. The current version is 1.0.5, but the project appears to be minimally maintained with limited configuration options (port, credentials, etc.) and no active release cadence. Key differentiators: standalone execution without a system MySQL install; synchronous start (blocks the process). Consider alternatives like 'mysql2' or 'mysqld' for more robust development database solutions.","status":"maintenance","version":"1.0.5","language":"javascript","source_language":"en","source_url":"https://github.com/BrodaNoel/mysql-server","tags":["javascript","mysql","mysqld","mariadb","database","db","isolated","portable","standalone"],"install":[{"cmd":"npm install mysql-server","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-server","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-server","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package only supports CommonJS require. No ESM or TypeScript definitions provided.","wrong":"import mysqlServer from 'mysql-server';","symbol":"default","correct":"const mysqlServer = require('mysql-server');"},{"note":"start() is synchronous and blocks the Node.js process until the server is stopped.","wrong":"","symbol":"start","correct":"mysqlServer.start();"},{"note":"stop() kills the MySQL server process.","wrong":"","symbol":"stop","correct":"mysqlServer.stop();"}],"quickstart":{"code":"const mysqlServer = require('mysql-server');\nconst mysql = require('mysql2'); // or mysql\n\nmysqlServer.start(); // blocks until Ctrl+C\n\n// In another process, connect:\nconst connection = mysql.createConnection({\n  host: 'localhost',\n  user: 'root',\n  password: '',\n  database: 'test'\n});\n\nconnection.query('SELECT 1', (err, results) => {\n  if (err) throw err;\n  console.log(results);\n});\n\nconnection.end();\nmysqlServer.stop();","lang":"javascript","description":"Demonstrates starting the bundled MySQL server, connecting with mysql2, running a query, and stopping the server."},"warnings":[{"fix":"Run start() in a separate child process or use the package only for background testing.","message":"start() is synchronous and blocks the Node.js event loop - your script will hang until the server is stopped.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If you need custom config, consider alternatives like 'mysql2' or a proper MySQL installation.","message":"No configuration options available - port, username, password are hardcoded (port 3306, user root, no password).","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Evaluate whether this package meets long-term needs or switch to 'mysql2' or 'dockerode' with MySQL Docker container.","message":"The package is not actively maintained; issues and feature requests may not be addressed.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Be patient; subsequent starts are faster.","message":"First run may be slow due to unzipping MySQL binaries - expect a delay of several seconds.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.5':43 'activ':61 'altern':79 'appear':47 'automat':25 'binari':23 'block':75 'bundl':21 'cadenc':63 'configur':54 'consid':78 'credenti':57 'current':40 'databas':88,94 'db':95 'develop':17,87 'differenti':65 'etc':58 'execut':67 'instal':38,72 'instanc':32 'isol':10,96 'javascript':90 'key':64 'like':80 'limit':53 'local':31 'maintain':51 'manag':26 'mariadb':15,93 'minim':50 'mysql':2,12,22,37,71,91 'mysql-serv':1 'mysql2':81 'mysqld':83,92 'node.js':5 'option':55 'packag':6 'port':56 'portabl':11,97 'process':77 'project':46 'provid':8 'releas':62 'requir':34 'robust':86 'separ':36 'server':3,13 'solut':89 'standalon':66,98 'start':27,74 'stop':29 'synchron':73 'system':70 'test':19 'version':41 'without':33,68","created_at":"2026-06-05T16:59:24.076309+00:00","updated_at":"2026-06-05T16:59:24.076309+00:00","problems":[{"fix":"Run: npm install mysql-server","cause":"Forgetting to install the package or using wrong import syntax.","error":"Error: Cannot find module 'mysql-server'"},{"fix":"Run: sudo chmod +x /path/to/mysqld or install the package globally with npm (not recommended).","cause":"Missing execute permissions on MySQL binary or running without sufficient privileges.","error":"EACCES: permission denied, open '/usr/local/lib/node_modules/mysql-server/bin/mysqld'"},{"fix":"Ensure mysqlServer.start() was called and wait a few seconds for the server to initialize.","cause":"MySQL server is not running or socket path is different.","error":"ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)"}],"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/BrodaNoel/mysql-server#readme","github":"https://github.com/BrodaNoel/mysql-server","docs":null,"changelog":null,"pypi":null,"npm":"mysql-server","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}}