如何使用node执行mysql转储文件

时间:2015-07-15 09:08:22

标签: mysql node.js

您好我正在使用gruntfile创建sql文件的转储,并希望在另一台服务器上执行该文件。

创建转储的代码工作正常,但我无法执行该转储。 请帮助我..我从昨天开始坚持下去。

var grunt=require('grunt');

module.exports = function(grunt) {


console.log("grunt called");
grunt.initConfig({
      // Load database config from external JSON (optional) 
      //db_config: grunt.file.readJSON('config/db.json'),

      db_dump: {
        options: {
          // common options should be defined here 
        },

        // "Local" target 
        "local": {
          "options": {
              "title": "Local DB",

            "database": "test",
            "user": "user",
            "pass": "pass",
            "host": "host1",

            "backup_to": "local.sql"
          }
        }
      },
      mysqlrunfile: {
            options: {
                connection: {
                    "database": "test",
                    "user": "user",
                    "pass": "pass",
                    "host": "host2",
                    multipleStatements: true
                },
                yourtarget1: {
                    src: ['/local.sql']
                }
            }
        }

    });


require('load-grunt-tasks')(grunt);



 };

0 个答案:

没有答案
相关问题