{"id":43286,"library":"mysql-import-fu3e","title":"mysql-import-fu3e","description":"A Node.js library for importing .sql dump files into a MySQL database. Current stable version is 5.1.2. It supports importing single or multiple SQL files, directories, and arrays of paths with progress and completion callbacks. This is a fork of Pamblam/mysql-import with updated dependencies and Node.js engine requirements >5.0.0. Alternative to command-line mysql client, offering programmatic control and event-driven import monitoring.","status":"active","version":"5.1.2","language":"javascript","source_language":"en","source_url":"https://github.com/natalia-davis-fu3e/mysql-import-fu3e","tags":["javascript","nodejs","mysql","textfiles","import","sql"],"install":[{"cmd":"npm install mysql-import-fu3e","lang":"bash","label":"npm"},{"cmd":"yarn add mysql-import-fu3e","lang":"bash","label":"yarn"},{"cmd":"pnpm add mysql-import-fu3e","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required for MySQL database connection and query execution.","package":"mysql","optional":true}],"imports":[{"note":"This package uses CommonJS and does not support ES modules. Use require().","wrong":"import Importer from 'mysql-import-fu3e';","symbol":"Importer","correct":"const Importer = require('mysql-import-fu3e');"},{"note":"The package exports a single constructor via module.exports, so destructuring require works but direct named import does not.","wrong":"import { Importer } from 'mysql-import-fu3e';","symbol":"Importer","correct":"const { Importer } = require('mysql-import-fu3e');"},{"note":"Constructor expects an options object, not positional arguments.","wrong":"const importer = new Importer(host, user, password, database);","symbol":"importer","correct":"const importer = new Importer({host, user, password, database});"}],"quickstart":{"code":"const Importer = require('mysql-import-fu3e');\nconst importer = new Importer({\n  host: process.env.MYSQL_HOST ?? 'localhost',\n  user: process.env.MYSQL_USER ?? 'root',\n  password: process.env.MYSQL_PASSWORD ?? '',\n  database: process.env.MYSQL_DATABASE ?? 'mydb'\n});\n\nimporter.onProgress(progress => {\n  const percent = Math.floor(progress.bytes_processed / progress.total_bytes * 10000) / 100;\n  console.log(`${percent}% Completed`);\n});\n\nimporter.import('path/to/dump.sql')\n  .then(() => {\n    const files_imported = importer.getImported();\n    console.log(`${files_imported.length} SQL file(s) imported.`);\n  })\n  .catch(err => console.error(err));","lang":"javascript","description":"Imports a SQL dump file with progress tracking using the Importer class."},"warnings":[{"fix":"Use new Importer({host: 'localhost', user: 'root', ...})","message":"Constructor expects an options object, not individual arguments. Passing host, user as separate strings will cause a connection error.","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Use require() instead of import.","message":"The package uses CommonJS. Attempting to use ES module import syntax will fail.","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Switch to a library that uses mysql2, or manually replace dependency.","message":"The 'mysql' package is deprecated; consider using 'mysql2' for better performance and security.","severity":"deprecated","affected_versions":">=5.0.0"},{"fix":"Call importer.setEncoding('utf8') before importer.import().","message":"Encoding must be set before import. Setting after import starts has no effect.","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Handle both promise rejection and onDumpCompleted callback errors.","message":"The import() method resolves when all files are processed. Errors during import are caught by the promise rejection, but callbacks may fire after rejection.","severity":"gotcha","affected_versions":">=5.0.0"}],"env_vars":null,"search_vec":"'5.0.0':53 '5.1.2':21 'altern':54 'array':32 'callback':39 'client':60 'command':57 'command-lin':56 'complet':38 'control':63 'current':17 'databas':16 'depend':48 'directori':30 'driven':67 'dump':11 'engin':51 'event':66 'event-driven':65 'file':12,29 'fork':43 'fu3e':4 'import':3,9,24,68,74 'javascript':70 'librari':7 'line':58 'monitor':69 'multipl':27 'mysql':2,15,59,72 'mysql-import-fu3e':1 'node.js':6,50 'nodej':71 'offer':61 'pamblam/mysql-import':45 'path':34 'programmat':62 'progress':36 'requir':52 'singl':25 'sql':10,28,75 'stabl':18 'support':23 'textfil':73 'updat':47 'version':19","created_at":"2026-06-05T16:59:04.358331+00:00","updated_at":"2026-06-05T16:59:04.358331+00:00","problems":[{"fix":"Change to const Importer = require('mysql-import-fu3e');","cause":"Using ES module import syntax with a CommonJS-only package.","error":"TypeError: Importer is not a constructor"},{"fix":"Verify credentials and host in the options object passed to the Importer constructor.","cause":"Incorrect or missing password, or the user does not have access from the specified host.","error":"Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'@'localhost'"},{"fix":"Provide at least one valid file or directory path to import().","cause":"import() called with an empty argument list or invalid path that doesn't resolve to any files.","error":"Error: Cannot read property 'length' 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/natalia-davis-fu3e/mysql-import-fu3e#readme","github":"https://github.com/natalia-davis-fu3e/mysql-import-fu3e","docs":null,"changelog":null,"pypi":null,"npm":"mysql-import-fu3e","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}}