I'm trying to execute sql queries from a file in nodejs.
This is the (summarized) code:
var fs = require("fs");
var mysql = require("mysql");
fs.readFile("path/to/my.sql", function(error, query) {
mysql.connect(configuration, function(error, connection) {
connection.query(query.toString(), callback); // this doesn't work
}
}
Upon execution, following error is passed to my callback function:
{"code":"ER_PARSE_ERROR","index":0}
I have verified that: