Registry / database / grunt-mysql-dump

grunt-mysql-dump

JSON →
library1.1.0jsnpmunverified

Grunt plugin for dumping MySQL databases as part of a deployment pipeline. Version 1.1.0, last updated in 2014. It relies on the mysqldump command-line tool and Grunt ~0.4.1. Unlike more modern task runners, this plugin is tightly coupled to the Grunt 0.4 ecosystem and is not actively maintained. It supports both local and SSH remote connections but lacks encryption or password protection for backup files. It is recommended only for legacy projects.

npm install grunt-mysql-dump
INSTALL
IMPORT
SIG · GRUNT-MYSQL-DUMP
G
grunt-mysql-dump
databasejavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

grunt
const grunt = require('grunt');
import grunt from 'grunt';
Grunt plugins are loaded via require() and then grunt.loadNpmTasks(). This plugin does not export ES6 modules.
db_dump task
grunt.loadNpmTasks('grunt-mysql-dump');
const db_dump = require('grunt-mysql-dump');
The plugin is loaded as a Grunt task, not imported directly.
Configuration
grunt.initConfig({ db_dump: { target: { options: { ... } } } });
grunt.initConfig({ mysql_dump: { ... } });
The task name in configuration must be 'db_dump'. The old name 'mysql_dump' is a common mistake.

Shows how to install, load, configure, and run the grunt-mysql-dump plugin for a local database dump.

npm install grunt-mysql-dump --save-dev // Gruntfile.js module.exports = function(grunt) { grunt.loadNpmTasks('grunt-mysql-dump'); grunt.initConfig({ db_dump: { local: { options: { database: 'mydb', user: 'root', pass: 'password', host: 'localhost', backup_to: 'backup.sql' } } } }); grunt.registerTask('default', ['db_dump:local']); };
Debug
Known issues
deprecatedGrunt 0.4 is deprecated. Upgrade to Grunt 1.x or use a different build tool.
fix
Use Gulp or npm scripts instead of Grunt.
affects: <=1.1.0
gotchaOptions are passed as strings, even for boolean values. Ensure no typos in option names.
fix
Double-check option names: 'host', 'database', 'user', 'pass', 'backup_to', 'ssh_host'.
affects: >=0.0.0
gotchaThe plugin requires the 'mysqldump' command to exist on the system PATH. If not installed, the task fails silently.
fix
Install MySQL client tools: run 'sudo apt-get install mysql-client' or equivalent.
affects: >=0.0.0
gotchaSSH-based dumps can fail if SSH keys are not set up properly or if the SSH command is not in PATH.
fix
Test SSH connectivity manually and ensure the 'ssh' command is available.
affects: >=0.0.0
Errors
Common errors & fixes
Warning: Task "db_dump:local" failed. Use --force to continue.
The MySQL dump command exited with a non-zero exit code.
fix
Check MySQL credentials, database name, and that mysqldump is installed. Run 'mysqldump --version' to verify.
Fatal error: Unable to load task "db_dump"
Plugin not loaded or not installed.
fix
Run 'npm install grunt-mysql-dump --save-dev' and add 'grunt.loadNpmTasks("grunt-mysql-dump")' to your Gruntfile.
ReferenceError: grunt is not defined
Gruntfile is not structured properly; grunt is not passed into the wrapper function.
fix
Wrap your code in 'module.exports = function(grunt) { ... }'.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
gruntrequiredPeer dependency: Grunt ~0.4.1 required to run the plugin.
Agent activity
6 hits · last 30 days
node
6
Resources
grunt-mysql-dump — npm install grunt-mysql-dump · libregistry