{"id":43434,"library":"node-mysql-backup","title":"node-mysql-backup","description":"Node.js module for backing up MySQL database tables to SQL dump files. Version 1.0.1 is the latest stable. It provides simple API to export specified tables with options like extended inserts, DROP TABLE statements, locks, and key disabling. The package is a fork from a GitHub issue that optimizes performance over older alternatives. It depends on 'mysql' and 'extend' packages. Easy to use with callback-based API.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/zhaojunlike/node-mysql-backup","tags":["javascript"],"install":[{"cmd":"npm install node-mysql-backup","lang":"bash","label":"npm"},{"cmd":"yarn add node-mysql-backup","lang":"bash","label":"yarn"},{"cmd":"pnpm add node-mysql-backup","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core MySQL client for database connection","package":"mysql","optional":false},{"reason":"Deep merge of default options with user options","package":"extend","optional":false}],"imports":[{"note":"CommonJS module; no ESM export. Use require.","wrong":"import mysqldump from 'node-mysql-backup';","symbol":"default","correct":"const mysqldump = require('node-mysql-backup');"},{"note":"Default export is the function; named import not supported.","wrong":"const { mysqldump } = require('node-mysql-backup');","symbol":"the function itself is named 'mysqldump' in code","correct":"const mysqldump = require('node-mysql-backup'); mysqldump(options, callback);"},{"note":"dest option is mandatory","wrong":"const mysqldump = require('node-mysql-backup'); mysqldump({ host: 'localhost', user: 'root', password: 'pass', database: 'mydb' }, callback); // missing dest - will crash","symbol":"options object","correct":"const mysqldump = require('node-mysql-backup'); mysqldump({ host: 'localhost', user: 'root', password: 'pass', database: 'mydb', dest: './dump.sql' }, function(err) { ... });"}],"quickstart":{"code":"const mysqldump = require('node-mysql-backup');\n\nmysqldump({\n  host: 'localhost',\n  user: 'root',\n  password: process.env.MYSQL_PASSWORD ?? '',\n  database: 'testdb',\n  tables: ['users', 'orders'],\n  extendedInsert: true,\n  addDropTable: true,\n  addLocks: true,\n  disableKeys: true,\n  dest: './backup.sql'\n}, function (err) {\n  if (err) {\n    console.error('Backup failed:', err);\n    process.exit(1);\n  }\n  console.log('Backup completed successfully');\n});","lang":"javascript","description":"Exports specific MySQL tables to a SQL dump file using options like extended inserts and DROP TABLE."},"warnings":[{"fix":"Always provide a callback function as second argument.","message":"Callback is mandatory; if omitted, function will throw 'callback is not a function'","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Always specify dest option with a writable file path.","message":"dest option is required; if missing, script will try to write to undefined path causing error","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider using mysqldump package or mysql2-based alternatives.","message":"Package relies on mysql npm package which is not maintained; recommend using mysql2 instead (but this package requires mysql)","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use ssl option or connect over SSH tunnel.","message":"Password sent over network without encryption; ensure MySQL server uses TLS","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure sequential calls or use a mutex. Not recommended for concurrent backups.","message":"If function called multiple times without completion of previous, it may corrupt output file due to shared write stream","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.1':18 'altern':57 'api':26,72 'back':8 'backup':4 'base':71 'callback':70 'callback-bas':69 'databas':11 'depend':59 'disabl':42 'drop':36 'dump':15 'easi':65 'export':28 'extend':34,63 'file':16 'fork':47 'github':50 'insert':35 'issu':51 'javascript':73 'key':41 'latest':21 'like':33 'lock':39 'modul':6 'mysql':3,10,61 'node':2 'node-mysql-backup':1 'node.js':5 'older':56 'optim':53 'option':32 'packag':44,64 'perform':54 'provid':24 'simpl':25 'specifi':29 'sql':14 'stabl':22 'statement':38 'tabl':12,30,37 'use':67 'version':17","created_at":"2026-06-05T16:59:46.582909+00:00","updated_at":"2026-06-05T16:59:46.582909+00:00","problems":[{"fix":"mysqldump(options, function(err) { ... });","cause":"Missing second argument callback when calling mysqldump()","error":"TypeError: callback is not a function"},{"fix":"mysqldump({ host: ..., ... }, callback);","cause":"First argument options is undefined/null","error":"Error: Cannot read property 'host' of undefined"},{"fix":"Include 'dest' property in options object with a valid file path.","cause":"dest option not provided or undefined","error":"Error: ENOENT: no such file or directory, open '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/zhaojunlike/node-mysql-backup#readme","github":"https://github.com/zhaojunlike/node-mysql-backup","docs":null,"changelog":null,"pypi":null,"npm":"node-mysql-backup","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}}