I am using npm mysql module on windows 7.
connection.query(`source D:/mediapropel/wp_default_install.sql`, function (error, results, fields) {
if(error) throw error;
console.log("Database should be created1");
console.log('source '+ path.join(__dirname, '..', "\/\wp_default_install.sql")+'');
res.send('');
});
What I have tried:
'source D:/mediapropel/wp_default_install.sql'
'source '+ path.join(__dirname, '..', "\/\wp_default_install.sql")+''
"source " + "D:/mediapropel/wp_default_install.sql"
"source D:/\mediapropel/\wp_default_install.sql"
"source D:/\mediapropel/\wp_default_install.sql/\/"
Error message:
'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near \'source D:/mediapropel/wp_default_install.sql\' at line 1'`
The same query runs directly in the mysql command line properly as expected. Please advice where am I going wrong.