D
D
darklelik2016-01-15 13:22:56
MySQL
darklelik, 2016-01-15 13:22:56

Nodejs how to create tables in MySql from a dump?

Hello everyone, tell me how you can create tables from dmap in nodejs in MySQL

var mysql      = require('mysql');
var connection = mysql.createConnection({
    host     : '192.168.0.10',
    user     : 'root',
    password : 'pass',
    database : 'dbase'

});


connection.query('CREATE TABLE TerStops (Stop_id int, Stop_name VARCHAR(100),' +
    'Stop_lat VARCHAR(100),Stop_lon VARCHAR(100), PRIMARY KEY(Stop_id))',
    function(err, result){
        // Case there is an error during the creation
        if(err) {
            console.log(err);
        } else {
            console.log("Table Ter_Stops Created");
        }
    });

That's how it works,
but how to do it in order to slip the sql dump file instead of a request?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question